-
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
Changes from 23 commits
2b369e4
200d09e
6427431
6274e15
4465d47
5004b9d
cbd31c5
cfb516d
24b5e99
42b30a9
e69e114
7020c66
057bfaa
f5dd697
d626025
a1ec23c
c590a3c
7f7ad25
eb5e43c
4f72ec8
0dd17c6
0fd3993
e117242
831ebc9
744b5bc
bb2e9c4
8ea2fb4
c26e2ce
f90b7c1
bb86cb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Post release downstream version bump | ||
| description: Creates a version bump PR of repo tools in the specified downstream repo | ||
|
|
||
| inputs: | ||
| repo: | ||
| description: Downstream repo name | ||
| required: true | ||
| version: | ||
| description: Repo tools version for pull request | ||
| required: true | ||
| pat: | ||
| description: A GitHub personal access token used to authenticate the requests in this action | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Checkout SDK | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ inputs.repo }} | ||
| path: ${{ inputs.repo }} | ||
| token: ${{ inputs.pat }} | ||
|
|
||
| - 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 "[email protected]" | ||
| 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 | ||
|
Comment on lines
25
to
67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,11 +7,21 @@ on: | |
| type: string | ||
| required: false | ||
| description: 'Optionally specify a custom release version (minor version bump e.g.)' | ||
| kn-release: | ||
| sdk-version-bump: | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
| description: 'Whether the release is a KN variant of repo tools or not' | ||
| description: 'Whether to create an SDK version bump pull request for this release' | ||
| smithy-kotlin-version-bump: | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
| description: 'Whether to create a Smithy Kotlin version bump pull request for this release' | ||
| crt-kotlin-version-bump: | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
| description: 'Whether to create an CRT Kotlin version bump pull request for this release' | ||
|
||
|
|
||
| permissions: | ||
| id-token: write | ||
|
|
@@ -35,11 +45,7 @@ jobs: | |
| exit 0 | ||
| fi | ||
|
|
||
| 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) | ||
|
||
|
|
||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | ||
| PATCH_NUMBER=${PATCH%%[^0-9]*} | ||
|
|
@@ -63,12 +69,39 @@ jobs: | |
| aws-region: us-west-2 | ||
|
|
||
| - name: Run codebuild release job | ||
| id: release-job | ||
| uses: aws-actions/aws-codebuild-run-build@v1 | ||
| with: | ||
| project-name: publish-aws-kotlin-repo-tools | ||
| source-version-override: ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
|
|
||
| - name: AWS SDK Kotlin pull request | ||
| if: ${{ inputs.sdk-version-bump == 'true' }} | ||
| uses: aws/aws-kotlin-repo-tools/.github/actions/version-bump-pr@main | ||
|
||
| with: | ||
| repo: 'aws/aws-sdk-kotlin' | ||
| version: ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
| pat: ${{ secrets.CI_USER_PAT }} | ||
|
|
||
| - name: Smithy Kotlin pull request | ||
| if: ${{ inputs.smithy-kotlin-version-bump == 'true' }} | ||
| uses: aws/aws-kotlin-repo-tools/.github/actions/version-bump-pr@main | ||
| with: | ||
| repo: 'smithy-lang/smithy-kotlin' | ||
| version: ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
| pat: ${{ secrets.CI_USER_PAT }} | ||
|
|
||
| - name: CRT Kotlin pull request | ||
| if: ${{ inputs.crt-kotlin-version-bump == 'true' }} | ||
| uses: aws/aws-kotlin-repo-tools/.github/actions/version-bump-pr@main | ||
| with: | ||
| repo: 'aws/aws-crt-kotlin' | ||
| version: ${{ steps.resolve-new-version.outputs.NEW_VERSION }} | ||
| pat: ${{ secrets.CI_USER_PAT }} | ||
|
|
||
| - 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: Can be simplified:
git checkout -b $BRANCH