feat: add CI/CD deployment for relay and Blossom on Fly.io #33
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: CI/CD | |
| on: | |
| pull_request: | |
| push: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.8 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Typecheck | |
| run: bun run typecheck | |
| - name: Run tests | |
| run: bun test | |
| - name: Build deploy image | |
| run: docker build -t anchr:${{ github.sha }} . | |
| deploy-infra: | |
| name: Deploy ${{ matrix.app }} | |
| needs: ci | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: >- | |
| ${{ | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'push' && | |
| github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) | |
| }} | |
| concurrency: | |
| group: fly-${{ matrix.app }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| environment: | |
| name: production | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - app: relay | |
| config: fly.relay.toml | |
| - app: blossom | |
| config: fly.blossom.toml | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flyctl | |
| uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy ${{ matrix.app }} | |
| run: flyctl deploy --remote-only --config ${{ matrix.config }} | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-app: | |
| name: Deploy Anchr App | |
| needs: deploy-infra | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| concurrency: | |
| group: fly-production | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| environment: | |
| name: production | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flyctl | |
| uses: superfly/flyctl-actions/setup-flyctl@master | |
| - name: Deploy | |
| run: flyctl deploy --remote-only --config fly.toml | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |