-
Notifications
You must be signed in to change notification settings - Fork 6
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
ci: release ci #17
ci: release ci #17
Conversation
Signed-off-by: Thomas Chataigner <[email protected]>
Signed-off-by: Thomas Chataigner <[email protected]>
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 tested the e2e flow with the inline fixes and it works pretty well! I think we're on the right track
.github/workflows/release.yml
Outdated
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 |
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.
Can we remove this in favor of a shallow checkout?
.github/workflows/release.yml
Outdated
fetch-depth: 0 | ||
|
||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 |
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 deprecated, we should use dtolnay/rust-toolchain@stable
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.
Removed it as we don't need it anyway
.github/workflows/release.yml
Outdated
- name: Validate version | ||
run: | | ||
echo "Validating version..." | ||
VERSION_REGEX="^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" |
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 wasn't working for me, maybe I'm missing something? Repro'd locally with 0.1.0
and 1.0
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.
Changed the REGEX, it was for PERL 🤦
run: git push origin release/${{ github.event.inputs.version }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 |
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 action will check out and commit to the new branch for us, so we can remove the Create release branch
and Commit changes
steps.
We can also remove the token
and base
inputs as they are defaults, and update the action to v6
.github/workflows/release.yml
Outdated
# Regex from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string | ||
- name: Validate version | ||
run: | | ||
echo "Validating 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.
Nit: Would be nice to print the input version here
.github/workflows/release-merge.yml
Outdated
id: get-version | ||
run: | | ||
VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | cut -d'/' -f 2) | ||
echo "name=version::${VERSION}" | tee -a $GITHUB_OUTPUT |
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 format seems to not work with the following actions, I think it may be better to just set name=${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.
Changed it to echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
based on https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
.github/workflows/release-merge.yml
Outdated
|
||
|
||
- name: Push tag | ||
uses: laputansoft/[email protected] |
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: Switch to mathiedutour
variant as discussed. I noticed the action has automatic tag bumping based on https://github.com/semantic-release/semantic-release, may be worth creating an issue to peruse this later
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.
Actually removing this step, softprops/action-gh-release@v2
already creates a tag
.github/workflows/release-merge.yml
Outdated
- name: Create Release | ||
uses: mikepenz/[email protected] #softprops/action-gh-release | ||
with: | ||
body: ${{steps.github_release.outputs.changelog}} |
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 had to add tag_name: ${{ steps.get-version.outputs.name }}
as an input for it to work
.github/workflows/release-merge.yml
Outdated
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
uses: mikepenz/[email protected] #softprops/action-gh-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.
Nit: switch to softprops
as discussed
.github/workflows/release.yml
Outdated
run: | | ||
echo "Validating version..." | ||
VERSION_REGEX="^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" | ||
if [[ "${{ github.event.inputs.version }}" =~ $VERSION_REGEX ]]; then |
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: here and elsewhere you can just do ${{ inputs.version }}
Signed-off-by: Thomas Chataigner <[email protected]>
Signed-off-by: Thomas Chataigner <[email protected]>
7497abc
to
fae2d27
Compare
This PR aims to have a proper workflow for the releases of the Light Client workspace.
release.yml
: This workflow has to be manually triggered and takes a valid Semver formatted version as an input. It will create a release branhc, bump theCargo.toml
versions for our main crates and create a PR from the release branch ondev
release-merge.yml
: This workflow is meant to be triggered when a release branch is merged in main. For now it has one job, creating a tag that will refer to the head of the release branch.