@@ -3,21 +3,6 @@ name: Setup Release Candidate
33on :
44 workflow_dispatch :
55 inputs :
6- versionIncrement :
7- description : ' Release Version Increment'
8- default : ' Minor'
9- required : true
10- type : choice
11- options :
12- - Major
13- - Minor
14- - Patch
15- - Custom
16- customVersion :
17- description : " Custom Release Version (only used if release increment is 'Custom') - Format: 3.15.0"
18- default : ' '
19- required : false
20- type : string
216 commitId :
227 description : ' Commit ID to create RC from'
238 required : true
@@ -41,73 +26,20 @@ jobs:
4126 node-version : ' 18'
4227 cache : ' npm'
4328
44- - name : Calculate Release Versions
45- id : release-version
46- env :
47- CUSTOM_VERSION : ${{ inputs.customVersion }}
48- VERSION_INCREMENT : ${{ inputs.versionIncrement }}
29+ - name : Generate Branch Name
30+ id : branch-name
4931 run : |
50- customVersion="$CUSTOM_VERSION"
51- versionIncrement="$VERSION_INCREMENT"
52-
53- increment_version() {
54- local currentVersion=$1
55- if [[ "$versionIncrement" == "Custom" && -n "$customVersion" ]]; then
56- echo "$customVersion"
57- else
58- IFS='.' read -r major minor patch <<< "$currentVersion"
59- case "$versionIncrement" in
60- "Major")
61- major=$((major + 1))
62- minor=0
63- patch=0
64- ;;
65- "Minor")
66- minor=$((minor + 1))
67- patch=0
68- ;;
69- "Patch")
70- patch=$((patch + 1))
71- ;;
72- esac
73- echo "$major.$minor.$patch"
74- fi
75- }
76-
77- # Read and increment toolkit version
78- toolkitCurrentVersion=$(node -e "console.log(require('./packages/toolkit/package.json').version)" | sed 's/-SNAPSHOT//')
79- toolkitNewVersion=$(increment_version "$toolkitCurrentVersion")
80-
81- # Read and increment amazonq version
82- amazonqCurrentVersion=$(node -e "console.log(require('./packages/amazonq/package.json').version)" | sed 's/-SNAPSHOT//')
83- amazonqNewVersion=$(increment_version "$amazonqCurrentVersion")
84-
85- echo "TOOLKIT_VERSION=$toolkitNewVersion" >> $GITHUB_OUTPUT
86- echo "AMAZONQ_VERSION=$amazonqNewVersion" >> $GITHUB_OUTPUT
87- # Use date-based branch naming instead of version-based because we release
88- # both extensions (toolkit and amazonq) from the same branch, and they may
89- # have different version numbers. We can change this in the future
9032 echo "BRANCH_NAME=release/rc-$(date +%Y%m%d)" >> $GITHUB_OUTPUT
9133
92- - name : Create RC Branch and Update Versions
34+ - name : Create RC Branch
9335 env :
94- TOOLKIT_VERSION : ${{ steps.release-version.outputs.TOOLKIT_VERSION }}
95- AMAZONQ_VERSION : ${{ steps.release-version.outputs.AMAZONQ_VERSION }}
96- BRANCH_NAME : ${{ steps.release-version.outputs.BRANCH_NAME }}
36+ BRANCH_NAME : ${{ steps.branch-name.outputs.BRANCH_NAME }}
9737 run : |
9838 git config user.name "aws-toolkit-automation"
9939 git config user.email "<>"
10040
101- # Create RC branch using date-based naming
41+ # Create RC branch from specified commit
10242 git checkout -b $BRANCH_NAME
10343
104- # Update package versions individually
105- npm version --no-git-tag-version $TOOLKIT_VERSION -w packages/toolkit
106- npm version --no-git-tag-version $AMAZONQ_VERSION -w packages/amazonq
107-
108- # Commit version changes
109- git add packages/toolkit/package.json packages/amazonq/package.json package-lock.json
110- git commit -m "chore: bump versions - toolkit=$TOOLKIT_VERSION, amazonq=$AMAZONQ_VERSION"
111-
11244 # Push RC branch
11345 git push origin $BRANCH_NAME
0 commit comments