chore(slack): Add resolve alias (#269)
#570
This file contains hidden or 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: Deploy | |
| permissions: | |
| contents: read | |
| id-token: write | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy to ("prod" or "test")' | |
| type: environment | |
| default: test | |
| required: true | |
| env: | |
| BACKEND_IMAGE_REF: us-west1-docker.pkg.dev/${{ secrets.GCP_PROJECT_SLUG }}/firetower-docker/firetower:${{ github.sha }} | |
| STATIC_IMAGE_REF: us-west1-docker.pkg.dev/${{ secrets.GCP_PROJECT_SLUG }}/firetower-docker/nginx:${{ github.sha }} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Authenticate with GCP | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUM }}/locations/global/workloadIdentityPools/github/providers/github-prvdr | |
| - name: Login to Artifact Registry | |
| run: gcloud auth configure-docker us-west1-docker.pkg.dev | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4 | |
| - name: Build and push (backend) | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7 | |
| with: | |
| push: true | |
| tags: ${{ env.BACKEND_IMAGE_REF }} | |
| file: docker/backend.Dockerfile | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push (static assets) | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7 | |
| with: | |
| push: true | |
| tags: ${{ env.STATIC_IMAGE_REF }} | |
| file: docker/static.Dockerfile | |
| secrets: | | |
| sentry_auth_token=${{ secrets.SENTRY_AUTH_TOKEN }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy-db-migration-test: | |
| needs: [build] | |
| if: ${{ inputs.environment == 'test' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Authenticate with GCP | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUM }}/locations/global/workloadIdentityPools/github/providers/github-prvdr | |
| - name: Run migration (test) | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| job: firetower-test-db-migration | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| image: ${{ env.BACKEND_IMAGE_REF }} | |
| wait: true | |
| deploy-db-migration-prod: | |
| needs: [build] | |
| if: ${{ github.ref == 'refs/heads/main' && ((!inputs.environment) || inputs.environment == 'prod') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Authenticate with GCP | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUM }}/locations/global/workloadIdentityPools/github/providers/github-prvdr | |
| - name: Run migration (prod) | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| job: firetower-prod-db-migration | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| image: ${{ env.BACKEND_IMAGE_REF }} | |
| wait: true | |
| deploy-test: | |
| needs: [deploy-db-migration-test] | |
| if: ${{ inputs.environment == 'test' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - service: firetower-test | |
| multi_container: true | |
| - service: firetower-slack-app-test | |
| multi_container: false | |
| - service: firetower-async-test | |
| multi_container: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Authenticate with GCP | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUM }}/locations/global/workloadIdentityPools/github/providers/github-prvdr | |
| - name: Deploy ${{ matrix.service }} | |
| if: ${{ !matrix.multi_container }} | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| service: ${{ matrix.service }} | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| image: ${{ env.BACKEND_IMAGE_REF }} | |
| - name: Deploy ${{ matrix.service }} (multi-container) | |
| if: ${{ matrix.multi_container }} | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| service: ${{ matrix.service }} | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| flags: >- | |
| --container nginx --image "${{ env.STATIC_IMAGE_REF }}" --port 80 | |
| --container firetower-backend --image "${{ env.BACKEND_IMAGE_REF }}" | |
| deploy-prod: | |
| needs: [deploy-db-migration-prod] | |
| if: ${{ github.ref == 'refs/heads/main' && ((!inputs.environment) || inputs.environment == 'prod') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - service: firetower | |
| multi_container: true | |
| - service: firetower-slack-app | |
| multi_container: false | |
| - service: firetower-async-prod | |
| multi_container: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - name: Authenticate with GCP | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| workload_identity_provider: projects/${{ secrets.GCP_PROJECT_NUM }}/locations/global/workloadIdentityPools/github/providers/github-prvdr | |
| - name: Deploy ${{ matrix.service }} | |
| if: ${{ !matrix.multi_container }} | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| service: ${{ matrix.service }} | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| image: ${{ env.BACKEND_IMAGE_REF }} | |
| - name: Deploy ${{ matrix.service }} (multi-container) | |
| if: ${{ matrix.multi_container }} | |
| uses: google-github-actions/deploy-cloudrun@2028e2d7d30a78c6910e0632e48dd561b064884d # v3 | |
| with: | |
| service: ${{ matrix.service }} | |
| project_id: ${{ secrets.GCP_PROJECT_SLUG }} | |
| region: us-west1 | |
| flags: >- | |
| --container nginx --image "${{ env.STATIC_IMAGE_REF }}" --port 80 | |
| --container firetower-backend --image "${{ env.BACKEND_IMAGE_REF }}" |