GuidesAuto-deploy from GitHub
Deploy from GitHub Actions
A GitHub Actions job runs the tests, then calls the deploy hook.
name: deploy
on:
push:
branches: [main]
jobs:
test-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm test
- run: curl -fsS -X POST "$FERRY_DEPLOY_HOOK"
env:
FERRY_DEPLOY_HOOK: ${{ secrets.FERRY_DEPLOY_HOOK }}This job deploys after the tests pass. If npm test fails, the job stops before the curl line.
Set it up
Get the URL of the deploy hook
ferry deploy-hook show apiThe command prints the URL of the deploy hook. From GitHub, the URL must start with your public dashboard host.
Store the URL as a secret
Store the URL as a secret of your CI. The job above reads the secret with the name FERRY_DEPLOY_HOOK.
Add the workflow file
Add the file above to your repository.
Turn auto-deploy off
ferry update api --no-auto-deployIf auto-deploy stays on, a push also deploys through the webhook.