Skip to content

Commit 98b22cd

Browse files
authored
CU-8699j8f1r Update release workflow for MedCAT v2 (#5)
* CU-8699j8f1r: Update release branch to reflect the service (i.e MedCAT) * CU-8699j8f1r: Update release tag to indicate service being released * CU-8699j8f1r: Update MedCAT release workflow to run upon correct tag pushes * CU-8699j8f1r: Update version tag getting in worklfow * CU-8699j8f1r: Fix comment regarding release branch name in wokrflow * CU-8699j8f1r: Move to medcat/v<major>.<minor> release branches
1 parent 01b9c85 commit 98b22cd

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

.github/workflows/medcat-v2_release.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: medcat-v2 - Build Python Package
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "medcat/v*"
77

88
permissions:
99
contents: write
@@ -27,13 +27,11 @@ jobs:
2727
git fetch --all
2828
2929
# Get the tag without the 'v' and strip the patch version
30-
VERSION_TAG="${GITHUB_REF#refs/tags/v}"
31-
VERSION_MAJOR_MINOR="${VERSION_TAG%.*}" # This removes the patch version (everything after the second dot)
30+
VERSION_TAG="${GITHUB_REF#refs/tags/}"
31+
# NOTE: branch name is in line with version tag, except for the patch version
32+
BRANCH_NAME="${VERSION_TAG%.*}" # This removes the patch version (everything after the second dot)
3233
33-
# Construct the branch name (e.g., release/0.1)
34-
BRANCH_NAME="release/$VERSION_MAJOR_MINOR"
35-
36-
# Check out the corresponding release branch (e.g., release/0.1)
34+
# Check out the corresponding release branch (e.g., medcat/v0.1)
3735
git checkout $BRANCH_NAME
3836
3937
# Ensure the branch is up-to-date with the remote

medcat-v2/.release/prepare_minor_release.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
2323
echo "Error: version '$VERSION' must be in format X.Y.Z"
2424
exit 1
2525
fi
26+
VERSION_TAG="medcat/v$VERSION"
2627

2728
# Extract version components
2829
VERSION_MAJOR_MINOR="${VERSION%.*}"
2930
VERSION_PATCH="${VERSION##*.}"
30-
RELEASE_BRANCH="release/$VERSION_MAJOR_MINOR"
31+
RELEASE_BRANCH="medcat/v$VERSION_MAJOR_MINOR"
3132

3233
# Helpers
3334
run_or_echo() {
@@ -53,8 +54,8 @@ if git show-ref --quiet "refs/heads/$RELEASE_BRANCH" && [[ $FORCE == false ]]; t
5354
error_exit "Branch '$RELEASE_BRANCH' already exists. Use --force to override."
5455
fi
5556

56-
if git show-ref --quiet "refs/tags/v$VERSION" && [[ $FORCE == false ]]; then
57-
error_exit "Tag 'v$VERSION' already exists. Use --force to override."
57+
if git show-ref --quiet "refs/tags/$VERSION_TAG" && [[ $FORCE == false ]]; then
58+
error_exit "Tag '$VERSION_TAG' already exists. Use --force to override."
5859
fi
5960

6061
if [[ -n "$(git status --porcelain)" ]]; then
@@ -78,8 +79,8 @@ run_or_echo git add pyproject.toml
7879
run_or_echo git commit -m \"Bump version to $VERSION for release\"
7980

8081
# Create and push tag
81-
run_or_echo git tag -a \"v$VERSION\" -m \"Release v$VERSION\"
82+
run_or_echo git tag -a \"$VERSION_TAG\" -m \"Release v$VERSION\"
8283
run_or_echo git push origin \"$RELEASE_BRANCH\"
83-
run_or_echo git push origin \"v$VERSION\"
84+
run_or_echo git push origin \"$VERSION_TAG\"
8485

8586
run_or_echo git checkout main

medcat-v2/.release/prepare_patch_release.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
4646
echo "Error: version '$VERSION' must be in format X.Y.Z"
4747
exit 1
4848
fi
49+
VERSION_TAG="medcat/v$VERSION"
4950

5051
# Extract version components
5152
VERSION_MAJOR_MINOR="${VERSION%.*}"
5253
VERSION_PATCH="${VERSION##*.}"
53-
RELEASE_BRANCH="release/$VERSION_MAJOR_MINOR"
54+
RELEASE_BRANCH="medcat/v$VERSION_MAJOR_MINOR"
5455

5556
# some prerequisites
5657
[[ "$VERSION_PATCH" == "0" ]] && error_exit "Patch version must not be 0."
@@ -61,8 +62,8 @@ if ! git show-ref --verify --quiet "refs/remotes/origin/$RELEASE_BRANCH"; then
6162
error_exit "Release branch '$RELEASE_BRANCH' does not exist remotely."
6263
fi
6364

64-
if git rev-parse "v$VERSION" >/dev/null 2>&1 && ! $FORCE; then
65-
error_exit "Tag 'v$VERSION' already exists. Use --force to override."
65+
if git rev-parse "$VERSION_TAG" >/dev/null 2>&1 && ! $FORCE; then
66+
error_exit "Tag '$VERSION_TAG' already exists. Use --force to override."
6667
fi
6768

6869
if [[ -n "$(git status --porcelain)" && ! $FORCE ]]; then
@@ -82,9 +83,9 @@ if $MANUAL; then
8283
echo " sed -i 's/version = \".*\"/version = \"$VERSION\"/' pyproject.toml"
8384
echo " git add pyproject.toml"
8485
echo " git commit -m 'Bump version to $VERSION'"
85-
echo " git tag -a v$VERSION -m 'Release v$VERSION'"
86+
echo " git tag -a $VERSION_TAG -m 'Release v$VERSION'"
8687
echo " git push origin $RELEASE_BRANCH"
87-
echo " git push origin v$VERSION"
88+
echo " git push origin $VERSION_TAG"
8889
exit 0
8990
fi
9091

@@ -162,9 +163,9 @@ run_or_echo git commit -m \"Bump version to $VERSION\" --allow-empty
162163
# now do the tagging
163164
# NOTE: can force since without the `--force` flag we would have checked
164165
# for existing tag
165-
run_or_echo git tag -a \"v$VERSION\" -m \"Release v$VERSION\" --force
166+
run_or_echo git tag -a \"$VERSION_TAG\" -m \"Release v$VERSION\" --force
166167
run_or_echo git push origin \"$RELEASE_BRANCH\"
167-
run_or_echo git push origin \"v$VERSION\" --force
168+
run_or_echo git push origin \"$VERSION_TAG\" --force
168169

169170
run_or_echo git checkout main
170171

0 commit comments

Comments
 (0)