-
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
Detect whether version is prerelease #6
Conversation
This can be used in the actions/create-release action
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.
Looks good to me. With the PRERELEASE
defined we should be ready to use the create-release
action. That'd be useful for the cylc-ui
, where we release the packaged version via GitHub releases.
Thanks @MetRonnie !
@@ -21,3 +22,22 @@ runs: | |||
exit 1 | |||
fi | |||
echo "VERSION=$VERSION" >> $GITHUB_ENV |
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.
Don't remember if I had seen this way to set environment variables in GH actions. But good to learn/remember it 👍 https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
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.
They changed it last month or so due to a vulnerability in the old way of doing it
from packaging import version | ||
|
||
ver = version.Version(os.environ['VERSION']) | ||
is_pre = str(ver.is_prerelease).lower() |
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.
From the packaging
docs
is_prereleaseA boolean value indicating whether this Version instance represents a prerelease and/or development release.
I believe it follows what's defined in PEP-440 for pre-releases:
X.YaN # Alpha release
X.YbN # Beta release
X.YrcN # Release Candidate
X.Y # Final release
So alpha, beta, and release candidates will be treated as pre-releases👍
This can be used in the https://github.com/actions/create-release action