-
Notifications
You must be signed in to change notification settings - Fork 731
ci: create GitHub releases for release candidate branches #7862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| name: Setup Release Candidate | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| versionIncrement: | ||
| description: 'Release Version Increment' | ||
| default: 'Minor' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - Major | ||
| - Minor | ||
| - Patch | ||
| - Custom | ||
| customVersion: | ||
| description: "Custom Release Version (only used if release increment is 'Custom') - Format: 3.15.0" | ||
| default: '' | ||
| required: false | ||
| type: string | ||
| commitId: | ||
| description: 'Commit ID to create RC from' | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| setup-rc: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.commitId }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| persist-credentials: true | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
|
|
||
| - name: Calculate Release Versions | ||
| id: release-version | ||
| run: | | ||
| customVersion="${{ inputs.customVersion }}" | ||
| versionIncrement="${{ inputs.versionIncrement }}" | ||
|
|
||
| increment_version() { | ||
| local currentVersion=$1 | ||
| if [[ "$versionIncrement" == "Custom" && -n "$customVersion" ]]; then | ||
| echo "$customVersion" | ||
| else | ||
| IFS='.' read -r major minor patch <<< "$currentVersion" | ||
| case "$versionIncrement" in | ||
| "Major") | ||
| major=$((major + 1)) | ||
| minor=0 | ||
| patch=0 | ||
| ;; | ||
| "Minor") | ||
| minor=$((minor + 1)) | ||
| patch=0 | ||
| ;; | ||
| "Patch") | ||
| patch=$((patch + 1)) | ||
| ;; | ||
| esac | ||
| echo "$major.$minor.$patch" | ||
| fi | ||
| } | ||
|
|
||
| # Read and increment toolkit version | ||
| toolkitCurrentVersion=$(node -e "console.log(require('./packages/toolkit/package.json').version)" | sed 's/-SNAPSHOT//') | ||
| toolkitNewVersion=$(increment_version "$toolkitCurrentVersion") | ||
|
|
||
| # Read and increment amazonq version | ||
| amazonqCurrentVersion=$(node -e "console.log(require('./packages/amazonq/package.json').version)" | sed 's/-SNAPSHOT//') | ||
| amazonqNewVersion=$(increment_version "$amazonqCurrentVersion") | ||
|
|
||
| echo "TOOLKIT_VERSION=$toolkitNewVersion" >> $GITHUB_OUTPUT | ||
| echo "AMAZONQ_VERSION=$amazonqNewVersion" >> $GITHUB_OUTPUT | ||
| # Use date-based branch naming instead of version-based because we release | ||
| # both extensions (toolkit and amazonq) from the same branch, and they may | ||
| # have different version numbers. We can change this in the future | ||
| echo "BRANCH_NAME=rc-$(date +%Y%m%d)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create RC Branch and Update Versions | ||
| env: | ||
| TOOLKIT_VERSION: ${{ steps.release-version.outputs.TOOLKIT_VERSION }} | ||
| AMAZONQ_VERSION: ${{ steps.release-version.outputs.AMAZONQ_VERSION }} | ||
| BRANCH_NAME: ${{ steps.release-version.outputs.BRANCH_NAME }} | ||
| run: | | ||
| git config user.name "aws-toolkit-automation" | ||
| git config user.email "<>" | ||
|
|
||
| # Create RC branch using date-based naming | ||
| git checkout -b $BRANCH_NAME | ||
|
|
||
| # Update package versions individually | ||
| npm version --no-git-tag-version $TOOLKIT_VERSION -w packages/toolkit | ||
| npm version --no-git-tag-version $AMAZONQ_VERSION -w packages/amazonq | ||
|
|
||
| # Commit version changes | ||
| git add packages/toolkit/package.json packages/amazonq/package.json package-lock.json | ||
| git commit -m "Bump versions: toolkit=$TOOLKIT_VERSION, amazonq=$AMAZONQ_VERSION" | ||
|
|
||
| # Push RC branch | ||
| git push origin $BRANCH_NAME | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.