-
Notifications
You must be signed in to change notification settings - Fork 200
Workflow updates & release improvements #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Updated the versions of the used actions (where I noticed possible). Also replaced actions/create-release with softprops/action-gh-release because the former was archived in 2021. Based on a single suggestion I saw somewhere online, it's best to --ignore-scripts with npm ci. So I did that here too.
I wasn't extremely happy with the default github-generated release notes, specifically the changelog tag detection, so I used the suggestions I found in the softprops repo: mikepenz's release-changelog-builder-action. Added .github/changelog.json to customize the labels, categories, and output templates for the release notes. For it to work how I'd like, I had to manually construct the compare link from the action's detected tags and manually construct the NPM package url. Also had to add a manual npm pack step in order to provide the .tgz in the GitHub release assets, but that can be removed if desired.
Added a new workflow file: version.yml. This workflow simply runs npm version with the desired values and pushes the commit and tag back to the repository. Along with release.yml, this functionally creates on-demand npm and github releases from the click of a button. This workflow requires a PAT in-place of the GITHUB_TOKEN, as the workflow default GITHUB_TOKEN will **not** trigger GitHub Actions.
Whoops, forgot to add back the pull-request: read permissions while trying to keep a clean history and diff. And I accidentally left a comment that I didn't mean to. Also decided to change the "Push version" action to "Push new version".
Thanks @TheMrCam for taking the time and setting this up for discussion. Regarding I also like the manual |
Of course! Happy to help see this through.
Yeah sounds good to me, the emojis are just remnants from the action repository I pulled some examples from.
According to GitHub Docs, anyone with
Right! In order to ensure it always grabs the correct tag, I export the output from |
Per PR suggestion— and to align with personal preference— removed the emojis from the generated release notes category titles.
Not sure why the emoji commit broke CI, but it seems transient... testing...
Okay, that is fine. Anyone with write permissions could also push tags on his own, thus doing a release this way. So works for me!
I think this is fine and a clean way to do it! I would love to get some more feedback on this. But if none arrives we could merge this by the end of the week unless you want to refine it. |
Really impressive work @TheMrCam ! I have to admit that I'm still a bit of a novice when it comes to publishing through Github actions. I still publish from my laptop using np. I don't have much advice to give, but where possible, I think it would make sense to stick with the established pattern around version naming. I don't think "pre-" has been used before, but rather appending |
Thank you @DanielJDufour!
Ah, I somehow missed those
|
Hi, @TheMrCam . Thanks for the quick and thoughtful response! You've taught me a lot about how GH Actions work! I'm happy to defer to @constantinius on the decision of whether to keep "beta" in the release candidate version names. Just wanted to surface the question :-) |
Whoops, forgot to put id: publish on the npm-publish step, so the generated release notes wouldn't have had the necessary values from that step (or it would crash... not 100% sure).
After discussion in the PR, I've decided it is actually better to reduce the complexity and hardcode the preId when making pre* level versions. Leaving my comment blocks in this commit for posterity, but I'll delete them in the next because I don't think it needs to exist in master.
Removed the unnecessary "optional" commented code blocks from version.yml, and replaced them with a small explainer annotation at the top.
Quick update: I switched I don't have any other immediate changes to make, so should be good to go for review. |
Overview
This PR focuses on updating the GitHub Actions stack and improving the usability of CI and GitHub releases.
I'm happy to make any further changes, just figured a PR with an example diff was a better starting point for discussion than without.
Details
ci.yml & docs.yml
I didn't do much to these workflows, just updated the action and Node.js versions to latest.
release.yml
I focused my efforts in this PR on
release.yml
, specifically on generating release notes.First, I updated all the action versions like above. While doing so, I learned that
actions/create-release
was deprecated in March 2021. They suggest a few alternatives, includingsoftprops/action-gh-release
, which is used by PDAL so I figured it's a safe bet.Once I had that new release action working1, I decided I wasn't happy with the default
generate_release_notes: true
release notes. Based on this suggestion, I introducedmikepenz/release-changelog-builder-action
which does a better job of detecting the "previous release." The new changelog generation is configured via the new.github/changelog.json
, and I've already added a few labels to this repository to categorize changes for the next release.The following summary describes the release note categories and their associated tags:
I also made a few decisions about the GitHub releases here that we can alter or revert if desired:
npm pack
-
(implyingnpm version pre*
)mikepenz/release-changelog-builder-action
configuration, but did tweak the categories andpr_template
version.yml
This is an entirely new workflow for this repository (and for myself). I had the idea of triggering everything at the click of a button, including the
npm version <>
andgit push origin <>
steps, and this workflow (plusrelease.yml
) is my result.The idea here is that, from the repository page, we can go
Actions > Push new version > patch
and GitHub will handle the rest for us.version.yml
just runsnpm version [major | minor | patch | premajor | preminor | prepatch | prerelease]
(from a dropdown choice), then pushes the changes back to the branch and the created tag to the repo. The fun part is, through a PATVERSION_TOKEN
, that tag push will automatically triggerrelease.yml
.I'm not entirely certain if this workflow is needed or wanted here, and no worries if we want it removed from this PR. I mostly just dislike manually doing
git push && git push origin vX.Y.Z
and put this together as a solution for myself.I made a few decisions here as well that I want to call out:
preId
is required ifversion
starts with "pre"preId
is 'beta' (ifversion
starts with "pre")2.2.0-0
${{ github.actor }}
as commit user and${{ github.actor }}@users.noreply.github.com
as emailnpm version
, but I'm sure we could use something else (like dependabot?)TODO
The following needs to be completed for
version.yml
to function correctly:secrets.VERSION_TOKEN
secret PAT withcontents: write
permission to repositoryversion.yml
Process
These changes and ideas are based on a toy repository I setup to figure out how I'd want to do this. As such, I'd be glad to discuss additions, revisions, or any other issues with these workflows.
My process based on these workflows went along the lines of:
ci.yml
passed on all PRs,ci.yml
should pass onmaster
Actions > Push new version > patch
release.yml
to publish to npm and release to GitHubI admit my repository was a very minimal reproduction example meant to test a simplified equivalent to
geotiff.js
's build process, and I did ignore docs generation (so we'll want to watch it closely for breakages).The
version.yml
push does also re-triggerci.yml
, which may be undesirable since it's much more intensive here than my test example. Theoretically, bumping the package.json version shouldn't suddenly change the result ofci.yml
, so we may want to check for this.Other options
I'm sure there's millions of ways we could configure CI for this package, and I'm willing to explore other options and ideas.
For one, I have a workflow for personal repositories that recognizes
-alpha.
tags and publishes to npm using--tag alpha
rather than the defaultlatest
. I almost added that feature here, but I'm uncertain if that has any benefit to this package (based on previous publishings, at least).Additionally, I've had some ideas about something like holding off on the actual
npm publish
until the draft GitHub release is published as a true release. I didn't attempt that yet as I'm still gaining an understanding of GitHub releases and CI, but would be willing to try putting something like that together if it's desirable.Footnotes
For those curious: my testing ↩