Skip to content

Commit f30bf4b

Browse files
authored
fix: support pre-release identifiers in tags (#1422)
Had to update the regex in the GitHub workflow to allow suffixes like `-alpha.4`. Successfully ran: ``` ./scripts/create_github_release.sh 0.1.0-alpha.4 ``` to create https://github.com/openai/codex/releases/tag/codex-rs-b289c9207090b2e27494545d7b5404e063bd86f3-1-rust-v0.1.0-alpha.4 and verified that when I run `codex --version`, it prints `codex-cli 0.1.0-alpha.4`.
1 parent 1b7c8d2 commit f30bf4b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

.github/workflows/rust-release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ concurrency:
1515
group: ${{ github.workflow }}
1616
cancel-in-progress: true
1717

18-
env:
19-
TAG_REGEX: '^rust-v[0-9]+\.[0-9]+\.[0-9]+$'
20-
2118
jobs:
2219
tag-check:
2320
runs-on: ubuntu-latest
@@ -33,8 +30,8 @@ jobs:
3330
# 1. Must be a tag and match the regex
3431
[[ "${GITHUB_REF_TYPE}" == "tag" ]] \
3532
|| { echo "❌ Not a tag push"; exit 1; }
36-
[[ "${GITHUB_REF_NAME}" =~ ${TAG_REGEX} ]] \
37-
|| { echo "❌ Tag '${GITHUB_REF_NAME}' != ${TAG_REGEX}"; exit 1; }
33+
[[ "${GITHUB_REF_NAME}" =~ ^rust-v[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta)(\.[0-9]+)?)?$ ]] \
34+
|| { echo "❌ Tag '${GITHUB_REF_NAME}' doesn't match expected format"; exit 1; }
3835
3936
# 2. Extract versions
4037
tag_ver="${GITHUB_REF_NAME#rust-v}"

codex-rs/scripts/create_github_release.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
set -euo pipefail
44

5+
# By default, this script uses a version based on the current date and time.
6+
# If you want to specify a version, pass it as the first argument. Example:
7+
#
8+
# ./scripts/create_github_release.sh 0.1.0-alpha.4
9+
#
10+
# The value will be used to update the `version` field in `Cargo.toml`.
11+
512
# Change to the root of the Cargo workspace.
613
cd "$(dirname "${BASH_SOURCE[0]}")/.."
714

@@ -15,7 +22,11 @@ fi
1522
CURRENT_BRANCH=$(git symbolic-ref --short -q HEAD)
1623

1724
# Create a new branch for the release and make a commit with the new version.
18-
VERSION=$(printf '0.0.%d' "$(date +%y%m%d%H%M)")
25+
if [ $# -ge 1 ]; then
26+
VERSION="$1"
27+
else
28+
VERSION=$(printf '0.0.%d' "$(date +%y%m%d%H%M)")
29+
fi
1930
TAG="rust-v$VERSION"
2031
git checkout -b "$TAG"
2132
perl -i -pe "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml

0 commit comments

Comments
 (0)