Push to deploy
Don’t want to click the deploy button each time you make a change?
You can easily enable push to deploy by generating a deploy webhook. This means you can automatically trigger a deploy each time you push to your default branch.
In your settings, you should see Deployment webhook
, and the option to generate a deploy key for your server.
After pressing the Generate
key, you will see some output with a deploy link and a generated Github action:
The provided deploy key URL can be used anywhere, but it’s recommended to not expose the generated deploy key secret publicly.
Github action
Push to deploy can easily achieved with Github actions.
Store deploy hook secret on Github
To keep your webhook secret safe, we recommend storing it as a secret in your Github repo.
Go to Settings
in your repository.
Then, select Secrets and variables
Select Actions
in the sidebar menu, then hit the New repository secret
button.
Set the DEPLOY_HOOK_SECRET
to the generated webhook secret.
Set Github action secret
With Github actions, you can make a simple “deploy every time anyone pushes to a certain branch”. We will use the main
branch as default.
Create a folder inside your project repo to store Github actions:
mkdir -p .github/workflows
touch .github/workflows/trigger-deploy.yml
Inside the .github/workflows/trigger-deploy.yml
file, insert the following:
name: Auto deploy to Shipnix stage
run-name: $ auto deploying to Shipnix stage 🚀
on: [push]
jobs:
Trigger-Deploy-Webhook:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: echo "Github Owner ID $ "
- run: echo "Github commit hash $"
- run: echo "Github commit message $"
- run: curl --fail "https://shipnix.io/TriggerDeploy?serverId=YOUR_SERVER_ID&key=$&commitHash=$&githubUserId=$"
After adding this, you can commit changes and push. After a few seconds, this should trigger a deploy.