-
Notifications
You must be signed in to change notification settings - Fork 2
feat: automatic repo tools version bumps #158
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
Conversation
.github/workflows/run-release.yml
Outdated
| type: boolean | ||
| required: false | ||
| default: false | ||
| description: 'Whether to create an CRT Kotlin version bump pull request for this release' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: "an CRT" → "a CRT"
.github/workflows/run-release.yml
Outdated
|
|
||
| - name: AWS SDK Kotlin pull request | ||
| if: ${{ inputs.sdk-version-bump == 'true' }} | ||
| uses: aws/aws-kotlin-repo-tools/.github/actions/version-bump-pr@main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We should use the syntax for actions in the same repository:
uses: ./.github/actions/version-bump-pr
.github/workflows/run-release.yml
Outdated
| if [ "${{ inputs.kn-release }}" == "true" ]; then | ||
| CURRENT_VERSION=$(git tag --sort=-creatordate | grep -- '-kn$' | head -n 1) | ||
| else | ||
| CURRENT_VERSION=$(git tag --sort=-creatordate | grep -v -- '-kn$' | head -n 1) | ||
| fi | ||
| CURRENT_VERSION=$(git tag --sort=-creatordate | grep -- '-kn$' | head -n 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correctness: This retains the old logic for determining the previous K/N version number, which is not what we want. Since we're not cutting -kn releases anymore, we should probably just remove the grep filter altogether:
CURRENT_VERSION=$(git tag --sort=-creatordate | head -n1)
.github/workflows/run-release.yml
Outdated
| - name: Delete failed release tag | ||
| if: ${{ failure() }} | ||
| run: | | ||
| git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
| if [ "${{ steps.release-job.outcome }}" != "success" ]; then | ||
| git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Move the bash if up into the step if: by using failure with conditions:
- name: Delete failed release tag
if: ${{ failure() && steps.release-job.outcome != 'success' }}
run: |
git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }}| git branch $BRANCH | ||
| git checkout $BRANCH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can be simplified:
git checkout -b $BRANCH| - name: Create pull request | ||
| shell: bash | ||
| env: | ||
| REPO: ${{ inputs.repo }} | ||
| NEW_VERSION: ${{ inputs.version }} | ||
| GH_TOKEN: ${{ inputs.pat }} | ||
| run: | | ||
| BRANCH=repo-tools-$NEW_VERSION | ||
| cd $REPO | ||
| git branch $BRANCH | ||
| git checkout $BRANCH | ||
| git config user.name aws-sdk-kotlin-ci | ||
| git config user.email "aws-kotlin-sdk-automation@amazon.com" | ||
| sed -i "s/aws-kotlin-repo-tools-version = .*/aws-kotlin-repo-tools-version = \"$NEW_VERSION\"/" gradle/libs.versions.toml | ||
| git add gradle/libs.versions.toml | ||
| git commit -m "misc: repo tools v$NEW_VERSION" | ||
| git push --force --set-upstream origin $BRANCH | ||
| EXISTING_PR=$(gh pr list --head "$BRANCH" --state open --json number -q '.[0].number') | ||
| if [ -z "$EXISTING_PR" ]; then | ||
| PR_URL=$(gh pr create --title "misc: repo tools v$NEW_VERSION" --body "Bumps repo tools to v$NEW_VERSION") | ||
| PR_NUMBER=$(basename $PR_URL) | ||
| gh pr edit $PR_NUMBER --add-label "no-changelog" | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: It would be nice to see some logs from this action which could assist in debugging. Offhand, I might suggest dumping the libs.versions.toml file after modification, showing the URLs to the new or existing PRs, emitting a warning when the user checked the box for a repo but that repo already has an open PR, etc.
Issue #, if available:
N/A
Description of changes:
Allows us to create repo tools version bumps in downstream repos via our release workflow.
Example PRs:
aws/aws-sdk-kotlin#1734
aws/aws-sdk-kotlin#1734
aws/aws-crt-kotlin#210
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.