ci: use cloudflare/wrangler-action@v2 to avoid resolution errors #4
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 Worker | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate wrangler.toml from secrets | |
| run: | | |
| cat > worker/wrangler.toml <<EOF | |
| name = "codeledger" | |
| main = "src/index.js" | |
| compatibility_date = "$(date -u +%F)" | |
| account_id = "${{ secrets.CF_ACCOUNT_ID }}" | |
| [[kv_namespaces]] | |
| binding = "CANONICAL_MAP" | |
| id = "${{ secrets.CANONICAL_KV_ID }}" | |
| [site] | |
| bucket = "./public" | |
| [env.production] | |
| name = "codeledger" | |
| route = "codeledger.vkrishna04.me/api/*" | |
| EOF | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - name: Install worker dependencies | |
| working-directory: ./worker | |
| run: npm ci | |
| - name: Publish to Cloudflare Workers | |
| uses: cloudflare/wrangler-action@v2 | |
| with: | |
| apiToken: ${{ secrets.CF_API_TOKEN }} | |
| workingDirectory: ./worker | |
| args: deploy --env=production |