Skip to content

Commit 5e6aac6

Browse files
committed
ci: finish adapting scripts
1 parent d9d2636 commit 5e6aac6

File tree

3 files changed

+21
-39
lines changed

3 files changed

+21
-39
lines changed

.github/workflows/autorelease.yml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,13 @@ jobs:
3232
git config --global user.name ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
3333
git config --global user.email ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
3434
35-
# Retrieve the latest release tag from GitHub
36-
- name: Get Latest Release Branch (only for patch releases)
37-
if: ${{ inputs.release_type == 'patch' }}
38-
id: get-release
39-
run: |
40-
# Fetch all tags
41-
git fetch --tags
42-
43-
# Get the latest release tag
44-
LATEST_RELEASE=$(git tag --list "v*" --sort=-version:refname | head -n 1)
45-
46-
# Parse major and minor version numbers
47-
if [[ "$LATEST_RELEASE" =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
48-
MAJOR="${BASH_REMATCH[1]}"
49-
MINOR="${BASH_REMATCH[2]}"
50-
RELEASE_BRANCH="release/${MAJOR}.${MINOR}"
51-
echo "Latest release tag: $LATEST_RELEASE"
52-
echo "Associated release branch: $RELEASE_BRANCH"
53-
else
54-
echo "Error: Unable to parse the latest release tag."
55-
exit 1
56-
fi
57-
58-
# Export the release branch name
59-
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_ENV
60-
6135
# Run the patch release script
6236
- name: Run Patch Release Script
6337
if: ${{ inputs.release_type == 'patch' }}
6438
env:
6539
GITHUB_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
66-
RELEASE_BRANCH: ${{ env.RELEASE_BRANCH }}
6740
run: |
68-
./scripts/patch_release.sh ${{ env.RELEASE_BRANCH }}
41+
./scripts/patch_release.sh
6942
7043
# Run the major/minor release script
7144
- name: Run Major/Minor Release Script

scripts/major_minor_release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ if [ "$BUMP_TYPE" == "major" ]; then
4343
# New dev VERSION file: 1.1.dev0
4444
NEW_RELEASE_VERSION="$((MAJOR + 1)).0.0"
4545
NEW_DEV_VERSION="$((MAJOR + 1)).1.dev0"
46-
NEW_RELEASE_BRANCH="release/v$((MAJOR + 1)).0"
46+
NEW_RELEASE_BRANCH="release/$((MAJOR + 1)).0"
4747
elif [ "$BUMP_TYPE" == "minor" ]; then
4848
# VERSION file on main: 0.2.dev0
4949
# New release VERSION file: 0.2.0
5050
# New dev VERSION file: 0.3.dev0
5151
NEW_RELEASE_VERSION="$MAJOR.$MINOR.0"
5252
NEW_DEV_VERSION="$MAJOR.$((MINOR + 1)).dev0"
53-
NEW_RELEASE_BRANCH="release/v$MAJOR.$MINOR"
53+
NEW_RELEASE_BRANCH="release/$MAJOR.$MINOR"
5454
fi
5555

5656
# Create the release branch and bump the release version

scripts/patch_release.sh

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,30 @@
33
# Ensure the script exits if any command fails
44
set -e
55

6-
# Check if two arguments are passed
7-
if [ "$#" -ne 1 ]; then
8-
echo "Usage: $0 <release-branch-name>"
9-
exit 1
10-
fi
11-
12-
# Assign arguments to variables
13-
RELEASE_BRANCH=$1
14-
156
# Checkout main branch
167
git checkout main
178

189
# Pull the latest changes
1910
git pull
2011

12+
# Fetch all tags
13+
git fetch --tags
14+
15+
# Get the latest release tag
16+
LATEST_RELEASE=$(git tag --list "v*" --sort=-version:refname | head -n 1)
17+
18+
# Parse major and minor version numbers
19+
if [[ "$LATEST_RELEASE" =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+$ ]]; then
20+
MAJOR="${BASH_REMATCH[1]}"
21+
MINOR="${BASH_REMATCH[2]}"
22+
RELEASE_BRANCH="release/${MAJOR}.${MINOR}"
23+
echo "Latest release tag: $LATEST_RELEASE"
24+
echo "Associated release branch: $RELEASE_BRANCH"
25+
else
26+
echo "Error: Unable to parse the latest release tag."
27+
exit 1
28+
fi
29+
2130
# Checkout release branch
2231
git checkout $RELEASE_BRANCH
2332

0 commit comments

Comments
 (0)