Skip to content

ci: Do release tagging in CI and add --draft support #5652

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

Merged
merged 17 commits into from
Jan 11, 2023

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jan 10, 2023

This PR moves git tag from users local machine to the release.yaml actions workflow.

We no longer automatically trigger a release on tag push, instead the workflow must be triggered via ./scripts/release.sh or manually via workflow dispatch.

We now also support providing --draft flag to create draft releases.

Example run via workflow dispatch:

@mafredri mafredri self-assigned this Jan 10, 2023
@mafredri mafredri force-pushed the mafredri/ci-release-via-actions branch 2 times, most recently from 2571b36 to d52c639 Compare January 10, 2023 13:42
@mafredri mafredri marked this pull request as ready for review January 10, 2023 16:13
@mafredri mafredri force-pushed the mafredri/ci-release-via-actions branch from 3c4a2bf to 2449a80 Compare January 10, 2023 16:23
Co-authored-by: Dean Sheather <dean@deansheather.com>
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

I think that this is already in a good shape to merge in and improve iteratively. I left one question about fail safety, otherwise, it's 👍 .

# Cache commit metadata.
. ./scripts/release/check_commit_metadata.sh "$old_version" "$ref"

# Create new release tag.
Copy link
Member

Choose a reason for hiding this comment

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

nit: Is it possible to run the workflow for the same version twice? It happened to me a few times in the past that the release script broke down in the middle of releasing and I had to clean tags and artifacts manually before retrying. I'm curious if we need the safety mechanism here.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a good nit. I was thinking we can use the GH actions concurrency keyword to ensure only one instance can run at a time: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency

Copy link
Member Author

Choose a reason for hiding this comment

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

To add to this, the tag_version.sh script will error if the tag already exists, meaning we can't re-run this on main if HEAD already has been tagged:

git tag v0.14.2CI=1 ./scripts/release/tag_version.sh --ref HEAD --patch
Checking commit metadata for changes since v0.14.1...
No breaking changes detected, using "patch" increment.
Old version: v0.14.1
New version: v0.14.2
$ git tag -a v0.14.2 -m Release v0.14.2 f5d623ff
fatal: tag 'v0.14.2' already exists

Does this, combined with concurrency (meaning only one release can run at once) take care of your concern @mtojek?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, although more convenient behavior is to allow for multiple runs to perform missing actions. For example, if the first run didn't publish the release notes due to HTTP 500, the second can fix it.

Copy link
Member Author

@mafredri mafredri Jan 11, 2023

Choose a reason for hiding this comment

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

I see what you mean. I think that's fairly well addressed here since right now the critical part happens in "Publish release". If anything fails before the tag upload (GH release immediately follows), we can just restart the workflow.

I just realized it's possible to run the workflow for a specific tag, not just for a branch. If we need to in the future it should be fairly easy to modify it to not error in tag_version.sh if we're running it for a tag since most steps are repeatable.

I'll think about this some more, thanks for bringing it up.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for clarifying!

@mafredri mafredri merged commit 8e4af79 into main Jan 11, 2023
@mafredri mafredri deleted the mafredri/ci-release-via-actions branch January 11, 2023 16:38
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants