Hook to deploy Github Action artifacts to web servers
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-11-30 21:31:48 +00:00
.idea Add --workflow-pattern argument to filter processed workflows (#9) 2022-08-04 12:55:38 +01:00
.gitignore Add way to disable symlinking and process deployments by external script (#10) 2022-08-09 15:31:23 +01:00
gha-webhook-listener.py Also run the hook on scheduled builds 2022-11-30 21:31:48 +00:00
LICENSE Initial commit 2019-04-30 13:20:16 +01:00
README.md Add way to disable symlinking and process deployments by external script (#10) 2022-08-09 15:31:23 +01:00
setup.py use scm_version 2021-10-21 12:35:49 +01:00

gha-webhook-listener

Simple flask listener which will wait for Github webhook pokes, and when it gets one, downloads an artifact and unpacks it.

Based on a Buildkite version.

Github setup

Go to the project “Settings”, in the “Webhooks” section, and click on the “Add webhook” button. Make sure you set the “Content type” to application/json. The “Secret” is what you’ll pass as --webhook-token to the listener. Choose the “Let me select individual events” option and check only the “Workflow runs” box.

Command-line options

Option Short Default Description
--port -p 4000 The port to listen on for requests from Github
--extract -e ./extracted The location to extract .tar.gz files to
--archive-name -a content.tar.gz The name of the .tar.gz file within the artifact
--symlink -s ./latest Write a symlink to this location pointing to the extracted tarball. New builds will keep overwriting this symlink
--webhook-token Only accept pokes signed with this Github token
--api-token API access token for Github. Requires repo scope
--branch-name master Branch to accept build notifications for. Notifications for other branches will be ignored
--org Lock down to this Github org
--workflow-pattern Define a regex which workflow names must match
--artifact-pattern merged-content-artifact Define a regex which artifact names must match
--keep-versions Retain only this number of versions on disk. Set to a positive integer
--hook-script Script to run after each workflow run is processed. The full path to the extracted artifact will be passed as an argument

The API token passed as --api-token on the command line should be a Personal Access Token with repo access, from a Github user that can read the repository.

For more details, see --help.

TODO: add a hook so that we can do more complex unpacking.