githubEdit

GitHub Actions

You can prepare and deploy the gateway from CI.

Repository layout

.github/
  workflows/
    deploy-serverless-api-gateway.yml
api-config.json
wrangler.toml

Example workflow

name: Deploy Serverless API Gateway

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Prepare gateway worker
        uses: irensaltali/serverlessapigateway-action@main
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          configJson: ./api-config.json
          wranglerToml: ./wrangler.toml
          versionTag: v1.0.1

      - name: Deploy to Cloudflare Workers
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          workingDirectory: worker

Last updated