-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add Release PR actions #76
Conversation
41bdcab
to
09c214d
Compare
09c214d
to
a12b9fc
Compare
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 looks really nice 🎉 I have left a few comments
GITHUB_TOKEN: ${{ inputs.token }} | ||
shell: bash | ||
|
||
# Include the full patch version in the PR branch name if a patch, otherwise call it `release-pr` for a major or minor 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.
It might also be interesting to have different names for release branches as some repositories might have multiple releases of major/minor that could be triggered in parallel.
If that's too bothersome we'll just constrain ourselves to keep it to one at a time.
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.
A few questions inline!
git push origin $TAG_VERSION --follow-tags | ||
echo "tag-version=$TAG_VERSION" | tee -a "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
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.
I would consider either testing the length of the get-version
or making the subsequent steps conditional on if: steps.get-version.outputs.tag-version != ''
D='0|[1-9][0-9]*' | ||
PW='[0-9]*[a-zA-Z-][0-9a-zA-Z-]*' | ||
MW='[0-9a-zA-Z-]+' | ||
SEMVER_REGEX="^($D)\.($D)\.($D)(-(($D|$PW)(\.($D|$PW))*))?(\+($MW(\.$MW)*))?$" |
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.
I believe the official semver regex (from doc) is:
SEMVER_REGEX="^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$"
This one had minor differences, are they important?
# If major release, get latest minor release from prior major version | ||
# If minor release, get latest minor release from given major version | ||
if [[ "${{ inputs.release-type }}" == "major" || "${{ inputs.release-type }}" == "minor" ]]; then | ||
set +o pipefail |
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 disable pipefail here?
id: get-latest-release | ||
run: | | ||
set +o pipefail | ||
LATEST_RELEASE=$(gh release list --repo ${{ github.repository }} --limit 100 | grep -Ei "${{ inputs.tag-prefix }}" | head -n 1 | awk '{ print $1 }') |
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 disable pipefail here?
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.
Approving: there's no big deal item in my comments.
9c6136f
to
ba95e81
Compare
ba95e81
to
fbc79c1
Compare
Adds composite actions for an automated release PR and associated tag + GitHub release when the release PR is merged. Builds on prior work in collaboration with @tchataigner (1, 2)
release-pr.yml
Major/minor release
workflow_dispatch
, withmajor
orminor
as therelease-type
inputrelease/<tag-prefix>-v<version>
branch, e.g.release/aptos-v1.0
. Note thatrelease/
branches omit the SemVer patch version, as they are meant to persist for production and will iteratively incorporate any patches/hotfixes.release/aptos-v1.1
release-pr
that increments the version number inCargo.toml
, e.g.1.0.0
to1.1.0
release-pr
to the newrelease/
branch. This allows for CI, PR review, and any additional commits to be added for the release. These commits should generally be cherry-picked from existing commits to the default branch.tag-release
workflow. Therelease-pr
branch can be safely deleted, but therelease/
branch should be kept as the release source.Patch release
workflow_dispatch
, withpatch
as therelease-type
inputrelease/<tag-prefix>-v<version>
branch, e.g.release/aptos-v1.0
patch/<tag-prefix>-v<version>.<patch-version>
, e.g.patch/aptos-v1.0.1
, which increments the version number inCargo.toml
accordinglypatch/
branch to the newrelease/
branch. This allows for CI, PR review, and any additional commits to be added for the release.tag-release
workflow. Thepatch/
branch can be safely deleted, but therelease/
branch should be kept as the release source.tag-release.yml
release-pr
caller when the release PR is merged, as it relies on the head and base branch names for tagging.Downstream examples
Successful runs
TODOs
Cargo.toml
version if this is the latestmajor.minor
release