Repository navigation
GitHub Actions workflow to publish specification to GitHub Pages - #148
Conversation
|
You can see an example of this GHA workflow in action on my personal fork here https://github.com/joshuagl/specification/pull/5/checks?check_run_id=1870772911 |
|
Also an example of a failed run, because date was not changed, here: https://github.com/joshuagl/specification/pull/6/checks?check_run_id=1903153676 |
* Update to use GHA environment variables * Remove checks which are handled by GHA configuration -- we will configure CI to only run check_release on PRs to master Signed-off-by: Joshua Lock <[email protected]>
Run our check_release script on each PR to the specification Signed-off-by: Joshua Lock <[email protected]>
Signed-off-by: Joshua Lock <[email protected]>
Add some make driven automation to build releases of the specification and maintain an HTML index of releases. To be driven by a GitHub actions workflow calling make release with, i.e. mkdir build && cd build && make -f ../Makefile release Adds some helper scripts: * get_version.py: is a simple Python script which uses a regex to fetch the version number from a tuf-spec.md -- the script helps avoid dealing with different options between GNU grep (Linux) and BSD grep (macOS and other BSDs) * build_index.py: includes a string which replicates enough of the style of the bikeshed formatted specification to build an appropriately themed HTML page linking to latest, draft, and versioned releases Signed-off-by: Joshua Lock <[email protected]>
Add a workflow that will trigger on pushes to master which: * Builds the HTML version of the spec (using the Makefile) in a build directory * Moves the built HTML file as index.html to a versioned subdirectory of build * Moves the built HTML file as index.html to a 'latest' subdirectory of build * Switches to the 'gh-pages' branch and moves the conents of the build directory into the repo root * Builds an index of published versions as index.html at the root of the repo root * Commits the generated HTML files and pushes them to the gh-pages branch on GitHub Signed-off-by: Joshua Lock <[email protected]>
Add a rule to the Makefile to move draft builds into a draft subdirectory Signed-off-by: Joshua Lock <[email protected]>
Add a workflow that will trigger on pushes to draft which: * Builds the HTML version of the spec (using the Makefile) in a build subdirectory * Moves the built HTML file as an index.html to a 'draft' subdirectory * Switches to the gh-pages branch and moves the contents of the build subdirectory into the repo root * Commits the generated HTML files and pushes them to the gh-pages branch on GitHub Signed-off-by: Joshua Lock <[email protected]>
bde6ee5 to
ad64b49
Compare
|
I've updated this PR to not only convert to GitHub Actions, but also to include workflows to build, release (in the case of master) & publish the specification on pushes to the master and draft branches. Please take a look @lukpueh, @trishankatdatadog and @mnm678. |
lukpueh
left a comment
There was a problem hiding this comment.
Very impressive work, @joshuagl, and as usual, very nicely laid out (re commit separation and messages)!! 🎉
I'd like to take another look at the release and draft workflow files with a fresh set of eyes on Monday, but on a quick glance they seem to do what they should.
Our GitHub Actions workflow ensures we are on the correct branch when running the script during release, and preventing the script from being used on an arbitrary branch makes testing/debugging harder. Signed-off-by: Joshua Lock <[email protected]>
Make the name more indicative of the work being performed and ensure we are only running the job on pushes to the master branch. Signed-off-by: Joshua Lock <[email protected]>
2a6875c to
a45879c
Compare
|
Thank you for the detailed review @lukpueh. I've addressed your comments by removing the sanity check code, renaming the PR workflow name and adding a branch specifier to the PR workflow. |
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: draft |
There was a problem hiding this comment.
This is also triggered when merging into the branch via GH UI, right?
There was a problem hiding this comment.
Same comment applies in release.yml.
There was a problem hiding this comment.
That's right, a merge pushes changes to the branch and results in a 'push' event.
* Remove spurious message from check_release script * Cleanup whitespace in build_index Signed-off-by: Joshua Lock <[email protected]>
Use the mailing list address for the bot's git user.email. Clarify that this is a draft specification commit. Signed-off-by: Joshua Lock <[email protected]>
* Include the specification version in the commit message when adding the built version to the gh-pages branch. * Use the mailing list address for the automation's git user.email Signed-off-by: Joshua Lock <[email protected]>
Some good nits, I've addressed each in some follow-on commits. Please review the extra 3 patches and re-approve the PR at your convenience. |
|
If anyone has the time, I would appreciate a second review on this so we can get it merged and start publishing the newly formatted specification. |
mnm678
left a comment
There was a problem hiding this comment.
Looks great, thanks for all the work on this!
Here's a simple collection of scripts and GitHub Actions workflows to build and publish the bikeshed specification when it is updated.
On pushes to master the workflow will:
On pushes to draft the workflow will:
You can see an example of the automation here in action at https://joshuagl.github.io/specification/
Note: we need GitHub Actions and GitHub Pages enabling for the repository for this to work.
Fixes #145