Skip to content

Commit f9ec392

Browse files
Ensure --prerelease flag is passed to gh create release for pre-releases (#3004)
This changes our script to be explicit and pass the `--prerelease` version to our increasingly automated release pipeline when the `-` character is detected in the "version" property of the release being published. Typically, GitHub marks "latest" versions "based on semver"[1], but GitHub still marks "pre-release versions" (as defined by Semver 2.0 [2]) as "latest" irregardless of that meaning to semver. This seems a bit unexpected, but it is the way it is, so we'll account for it by making sure we're explicit. [1]: https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#:~:text=the%20latest%20release%20label%20will%20automatically%20be%20assigned%20based%20on%20semantic%20versioning [2]: https://semver.org/#spec-item-9 Follows-up: #3003 (root-cause) --------- Co-authored-by: Jeremy Lempereur <[email protected]>
1 parent 1e433fd commit f9ec392

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.circleci/config.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,19 @@ jobs:
649649
command: >
650650
cd artifacts && sha1sum *.tar.gz > sha1sums.txt
651651
- run:
652+
name: Create GitHub Release
652653
command: >
653-
gh release create $VERSION --notes-file /dev/null --title $VERSION artifacts/*
654+
case "$VERSION" in
655+
656+
# If the VERSION contains a dash, consider it a pre-release version.
657+
# This is in-line with SemVer's expectations/designations!
658+
*-*) gh release create $VERSION --prerelease --notes-file /dev/null --title $VERSION artifacts/* ;;
659+
660+
# In all other cases, publish it as the latest version.
661+
*) gh release create $VERSION --notes-file /dev/null --title $VERSION artifacts/* ;;
662+
663+
esac
664+
654665
- setup_remote_docker:
655666
version: 20.10.11
656667
docker_layer_caching: true

0 commit comments

Comments
 (0)