fix: bodge ci #297
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: Deploy Cloudflare Worker | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
NODE_VERSION: 20.x | |
jobs: | |
formatting: | |
name: verify formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'yarn' | |
cache-dependency-path: cf-workers/yarn.lock | |
- name: Install dependencies | |
working-directory: ./cf-workers | |
run: | | |
yarn install --immutable | |
- name: Verify formatting | |
working-directory: ./cf-workers | |
run: yarn format:check | |
deploy: | |
name: deploy to cloudflare | |
needs: formatting | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/deploy' && github.event_name == 'push' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'yarn' | |
- name: Install dependencies | |
working-directory: ./cf-workers | |
run: | | |
yarn install --immutable | |
- name: Run D1 migrations | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
workingDirectory: 'cf-workers' | |
command: d1 migrations apply rail-announcements | |
- name: Deploy worker | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
workingDirectory: 'cf-workers' |