Black Friday Sale: 50% off all plans for new accounts!
Use code BLACKFRIDAY50

Header

How to set up automatic deployments with DeployHQ’s GitHub Action

If you wish to use GitHub Actions for your DeployHQ automatic deployments, you can add our deployhq-action to your repository, and set it up in a couple of minutes. This integration uses your DeployHQ’s webhook URL to generate a POST request to it, and deploy your code automatically through DeployHQ (or manually, if you trigger the GitHub Action yourself).

As seen in the deployhq-action README.md, you will need to set up some environment variables in your repository before proceeding. These are the following:

  • DEPLOYHQ_WEBHOOK_URL (required): Your webhook URL for your DeployHQ project, found in your DeployHQ dashboard, in your project, under “Automatic Deployments”.
  • DEPLOYHQ_EMAIL (required): Your DeployHQ email address.
  • REPO_CLONE_URL: The path to your repository (as entered in the DeployHQ UI). If not set, it will be generated with GitHub Action's default environment variables. Nonetheless, we highly recommend setting this variable to avoid unexpected results.
  • REPO_REVISION: The revision you wish to deploy. Can also be set to "latest" if you wish to deploy the latest revision in your set branch. If not set, the default value is “latest".
  • REPO_BRANCH: The branch your revision is on. If not set, the default value is set to “main”.

With these secrets added to your repository configuration, copy the following YAML file contents and save them into your repository, under .github/workflows, in a file called workflow.yml. More details on how this workflow file works can be found here.

Once set up, make sure to delete the DeployHQ webhook which was added automatically to your GitHub repository at the time of creation of your DeployHQ project, located in your GitHub repository, under “Settings >> Webhooks”.

Location of the GitHub repository webhooks

Not doing so may cause a “double deployment”, as a push to your repository will trigger both the integrated webhook in your GitHub repository, as well as the deployhq-action GitHub Action.

Once this is set up, you should be able to trigger automatic deployments to your desired server directly through the GitHub Action.

For more details on this topic, feel free to check our GitHub README.md.

Tree

Proudly powered by Katapult. Running on 100% renewable energy.