Bump actions/labeler from 4 to 5 (#82) #366
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: 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 | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
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: | |
name: deploy app | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
environment: | |
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} | |
url: ${{ github.ref == 'refs/heads/main' && env.PRODUCTION_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@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install fsspec requests s3fs pandas | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy to Staging | |
run: | | |
flyctl deploy --remote-only --config fly.staging.toml | |
python update_database.py staging https://offsets-db-staging.fly.dev/files | |
- name: Deploy to Production | |
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
run: | | |
flyctl deploy --remote-only --config fly.prod.toml | |
python update_database.py production https://offsets-db.fly.dev/files |