Skip to content
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

Merged
merged 3 commits into from
Mar 21, 2024
Merged

Automated releases #16

merged 3 commits into from
Mar 21, 2024

Conversation

infinisil
Copy link
Member

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.

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
Copy link
Contributor

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;
Copy link
Contributor

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}
Copy link
Contributor

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.
Copy link
Contributor

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.

Suggested change
body='Automated release.
body='# Changelog
* PR
* PR
* PR
etc

Comment on lines +77 to +80
# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super helpful.

@philiptaron philiptaron merged commit adb1f8a into main Mar 21, 2024
1 check passed
@philiptaron philiptaron deleted the automated-releases branch March 21, 2024 20:58
@philiptaron
Copy link
Contributor

I hit the merge button to test in production. https://github.com/NixOS/nixpkgs-check-by-name/actions/runs/8381658441

@infinisil
Copy link
Member Author

Hopefully this works: #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants