GitHub Actions
Deploy Serverless API Gateway with GitHub Actions. CI/CD workflow using the serverlessapigateway-action and Cloudflare Wrangler action.
You can prepare and deploy the gateway from CI.
Repository layout
.github/
workflows/
deploy-serverless-api-gateway.yml
api-config.json
wrangler.tomlExample 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: workerNotes
Store your
CLOUDFLARE_API_TOKENas a GitHub Actions secret. Never commit API tokens to the repository.The
configJsonparameter should point to your API configuration file, which defines routing, CORS, authorizer, and server settings.For local development and manual deploys, see the Wrangler deployment guide.
Last updated