-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Automated releases #16
Conversation
This script fuly automates releases. In a future commit this will be run by CI I ran the script once to generate the initial version 0.1.0: https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/0.1.0
This calls the release script whenever a commit is pushed to the main branch, such that merging a PR that increases the version number immediately causes a new release This also turns off the other CI for pushes to the main branch, doesn't seem necessary
@@ -0,0 +1,16 @@ | |||
name: CD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: CD
isn't Release
like the filename (and I like "Maybe Release" 😉)
@@ -13,9 +13,11 @@ | |||
}: | |||
let | |||
fs = lib.fileset; | |||
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(builtins.fromTOML (builtins.readFile ...))
is lib.importTOML
# The system to pre-build the release for and distribute artifacts for | ||
system=x86_64-linux | ||
root=$(git rev-parse --show-toplevel) | ||
repository=${GITHUB_REPOSITORY:-NixOS/nixpkgs-check-by-name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's this needed? https://docs.github.com/en/actions/learn-github-actions/variables says that GITHUB_REPOSITORY is owner and root. Is this trying to not run unless on this specific repository?
gzip "$tmp/$system.nar" | ||
artifactName=$system.nar.gz | ||
|
||
body='Automated release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future: this is where the changelog goes.
body='Automated release. | |
body='# Changelog | |
* PR | |
* PR | |
* PR | |
etc |
# GitHub docs say to use the releases' upload_url, but that's of the RFC 6570 form, see | ||
# https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#hypermedia | ||
# And neither the GitHub CLI nor curl seem to have support for that right now, so let's do it | ||
# manually instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super helpful.
I hit the merge button to test in production. https://github.com/NixOS/nixpkgs-check-by-name/actions/runs/8381658441 |
Hopefully this works: #18 |
This sets up automated releases, mainly so that we can distribute a pre-built version of the tool, allowing Nixpkgs' CI to fetch it without building.
I used the release script to generate the first release, which also contains some info about how to use the artifact: https://github.com/NixOS/nixpkgs-check-by-name/releases/tag/0.1.0
See this Matrix message for historical context.
After this and #15 is merged, we could also extend the automated PRs to regularly update the version, such that we don't forget to do new releases.