Deploy metaculus.com (PRODUCTION) #678
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 metaculus.com (PRODUCTION) | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy-to-prod: | |
| runs-on: ubuntu-24.04 | |
| environment: prod_env | |
| env: | |
| HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
| HEROKU_APP: metaculus-web | |
| ENV_DOCKER_TAG: prod | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build and deploy to Heroku | |
| run: | | |
| curl https://cli-assets.heroku.com/install-ubuntu.sh | sh | |
| heroku container:login # uses the HEROKU_API_KEY | |
| ./scripts/deploy_to_heroku.sh | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push to ghcr.io | |
| run: | | |
| docker build --platform linux/amd64 . -t ghcr.io/metaculus/metaculus:$ENV_DOCKER_TAG-$GITHUB_SHA -t ghcr.io/metaculus/metaculus:latest --target all_runners --push | |
| - name: "Cloudflare: Purge cache" | |
| run: | | |
| curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \ | |
| -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \ | |
| -H "Content-Type: application/json" \ | |
| --data '{"purge_everything":true}' | |
| - name: "Sentry: Upload sourcemaps" | |
| run: | | |
| docker run -w /app/front_end -e SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} registry.heroku.com/$HEROKU_APP/web npx sentry-cli sourcemaps upload /app/front_end/.next/ --project metaculus-frontend --org metaculus | |
| deploy-storybook: | |
| needs: [ deploy-to-prod ] | |
| uses: ./.github/workflows/storybook.yml | |
| secrets: inherit |