Merge pull request #2 from Juanperias/main #32
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 to production | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/deploy.yml" | |
| - "wrangler.toml" | |
| - "src/**/**.rs" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| - "rust-toolchain.toml" | |
| jobs: | |
| quality-gate: | |
| uses: ./.github/workflows/quality-gate.yml | |
| with: | |
| checks-command: "--all --check" | |
| clippy-command: "-- -D warnings" | |
| tests-command: "test" | |
| deploy: | |
| needs: [quality-gate] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install nix | |
| uses: nixbuild/nix-quick-install-action@v30 | |
| with: | |
| nix_conf: | | |
| keep-env-derivations = true | |
| keep-outputs = true | |
| - name: Restore and save Nix store | |
| uses: nix-community/cache-nix-action@v6 | |
| with: | |
| primary-key: build-${{ runner.os }}-${{ hashFiles('**/*.nix', 'flake.lock') }} | |
| restore-prefixes-first-match: build-${{ runner.os }}- | |
| - name: Build nix | |
| run: nix build | |
| - name: Fix up wrangler toml | |
| working-directory: . | |
| run: | | |
| echo "---- Before" | |
| cat wrangler.toml | |
| cat wrangler.toml | sed 's/main = "build/main = "result/' | sed 's/command = "worker-build --release"/command = "echo dummy build"/' >| wrangler.prod.toml | |
| echo "---- After" | |
| cat wrangler.prod.toml | |
| - name: Deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| env: | |
| CANGREBOT_API_ENDPOINT: ${{ secrets.CANGREBOT_API_ENDPOINT }} | |
| CANGREBOT_APIKEY: ${{ secrets.CANGREBOT_APIKEY }} | |
| with: | |
| wranglerVersion: "4.19.1" | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: deploy -c wrangler.prod.toml | |
| secrets: | | |
| CANGREBOT_API_ENDPOINT | |
| CANGREBOT_APIKEY |