support Cercarbono and Isometric registries in the API #976
Workflow file for this run
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: fly | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - labeled | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| AWS_DEFAULT_REGION: us-west-2 | |
| OFFSETS_DB_API_KEY_STAGING: ${{ secrets.OFFSETS_DB_API_KEY_STAGING }} | |
| OFFSETS_DB_API_KEY_PRODUCTION: ${{ secrets.OFFSETS_DB_API_KEY_PRODUCTION }} | |
| PRODUCTION_URL: 'https://offsets-db.fly.dev/docs' | |
| STAGING_URL: 'https://offsets-db-staging.fly.dev/docs' | |
| jobs: | |
| deploy-staging: | |
| name: deploy staging | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| environment: | |
| name: staging | |
| url: ${{ env.STAGING_URL }} | |
| if: ${{ (contains(github.event.pull_request.labels.*.name, 'api') && github.event_name == 'pull_request') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch'}} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: configure aws credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: arn:aws:iam::631969445205:role/github-action-role | |
| role-session-name: offsets-db-fly-role-session | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Set up pixi | |
| uses: prefix-dev/setup-pixi@v0.9.5 | |
| with: | |
| cache: true | |
| locked: true | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy to Staging | |
| run: | | |
| flyctl deploy --remote-only --config fly.staging.toml | |
| pixi run update-db-staging | |
| deploy-production: | |
| name: deploy production | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| needs: deploy-staging | |
| environment: | |
| name: production | |
| url: ${{ env.PRODUCTION_URL }} | |
| if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: configure aws credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: arn:aws:iam::631969445205:role/github-action-role | |
| role-session-name: offsets-db-fly-role-session | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Get Current time in UTC in format YYYY-MM-DD HH:MM | |
| if: always() | |
| id: time | |
| run: echo "date=$(date -u +'%Y-%m-%d %H:%M')" >> $GITHUB_OUTPUT | |
| - name: Set up pixi | |
| uses: prefix-dev/setup-pixi@v0.9.5 | |
| with: | |
| cache: true | |
| locked: true | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy to Production | |
| run: | | |
| flyctl deploy --remote-only --config fly.prod.toml | |
| - name: Notify Slack on Failure | |
| if: failure() | |
| uses: slackapi/slack-github-action@v3.0.1 | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| { | |
| "channel": "C06CXEYKMBP", | |
| "attachments": [ | |
| { | |
| "color": "#ff0000", | |
| "blocks": [ | |
| { | |
| "type": "header", | |
| "text": { | |
| "type": "plain_text", | |
| "text": "Fly Deployment Failure Alert 🚨" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "fields": [ | |
| { | |
| "type": "mrkdwn", | |
| "text": "*GH event:*\n${{ github.event_name }}" | |
| }, | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Time:*\n${{ steps.time.outputs.date }} UTC" | |
| } | |
| ] | |
| }, | |
| { | |
| "type": "section", | |
| "fields": [ | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Details URL:*\n🔍 <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Workflow Run>" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| - name: Update Production DB | |
| run: | | |
| pixi run update-db-production |