Deploy by @MSzalowski #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy GovTool to BETA server | |
run-name: Deploy by @${{ github.actor }} | |
# That should be executed on create: tag event | |
on: | |
workflow_dispatch: | |
inputs: | |
isProposalDiscussionForumEnabled: | |
description: "Enable proposal discussion forum" | |
required: true | |
type: choice | |
default: "enabled" | |
options: | |
- "enabled" | |
- "disabled" | |
forceRebuildDockerImages: | |
description: "Force rebuild the docker images" | |
required: false | |
type: choice | |
default: "false" | |
options: | |
- "true" | |
- "false" | |
env: | |
ENVIRONMENT: "beta" | |
CARDANO_NETWORK: "sanchonet" | |
DOMAIN: "sanchogov.tools" | |
FORCE_REBUILD: ${{inputs.forceRebuildDockerImages == 'true'}} | |
jobs: | |
deploy: | |
name: Deploy app | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./scripts/govtool | |
env: | |
DBSYNC_POSTGRES_DB: ${{ secrets.DBSYNC_POSTGRES_DB || 'cexplorer' }} | |
DBSYNC_POSTGRES_PASSWORD: ${{ secrets.DBSYNC_POSTGRES_PASSWORD || 'pSa8JCpQOACMUdGb' }} | |
DBSYNC_POSTGRES_USER: ${{ secrets.DBSYNC_POSTGRES_USER || 'postgres' }} | |
DBSYNC_POSTGRES_HOST: ${{ secrets.DBSYNC_POSTGRES_HOST || 'postgres' }} | |
DBSYNC_POSTGRES_PORT: ${{ secrets.DBSYNC_POSTGRES_PORT || '5432' }} | |
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }} | |
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }} | |
GRAFANA_ADMIN_PASSWORD: ${{ secrets.GRAFANA_ADMIN_PASSWORD }} | |
GRAFANA_SLACK_OAUTH_TOKEN: ${{ secrets.GRAFANA_SLACK_OAUTH_TOKEN }} | |
GRAFANA_SLACK_RECIPIENT: ${{ secrets.GRAFANA_SLACK_RECIPIENT }} | |
GTM_ID: ${{ secrets.GTM_ID }} | |
NPMRC_TOKEN: ${{ secrets.NPMRC_TOKEN }} | |
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }} | |
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }} | |
NEXT_PUBLIC_API_URL: "https://participation.sanchogov.tools" | |
NEXT_PUBLIC_GA4_PROPERTY_ID: ${{ secrets.NEXT_PUBLIC_GA4_PROPERTY_ID }} | |
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }} | |
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }} | |
SENTRY_IGNORE_API_RESOLUTION_ERROR: "1" | |
TRAEFIK_LE_EMAIL: "admin+govtool@binarapps.com" | |
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }} | |
IS_PROPOSAL_DISCUSSION_FORUM_ENABLED: ${{ inputs.isProposalDiscussionForumEnabled == 'enabled' }} | |
PDF_API_URL: ${{ secrets.PDF_API_URL}} | |
IPFS_GATEWAY: ${{ secrets.IPFS_GATEWAY }} | |
IPFS_PROJECT_ID: ${{ secrets.IPFS_PROJECT_ID }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.GHA_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GHA_AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Login to AWS ECR | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-west-1 | |
- name: Setup SSH agent | |
uses: webfactory/ssh-agent@v0.8.0 | |
with: | |
ssh-private-key: ${{ secrets.GHA_SSH_PRIVATE_KEY }} | |
- name: Deploy app | |
run: | | |
make --debug=b all | |
- name: Reprovision Grafana | |
run: | | |
sleep 30 # give grafana time to start up | |
make --debug=b reload-grafana |