Skip to content

feat: automatic repo tools version bumps #80

feat: automatic repo tools version bumps

feat: automatic repo tools version bumps #80

Workflow file for this run

name: Release
on:
pull_request:
workflow_dispatch:
inputs:
version-override:
type: string
required: false
description: 'Optionally specify a custom release version (minor version bump e.g.)'
sdk-version-bump:
type: boolean
required: false
default: false
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 a CRT Kotlin version bump pull request for this release'
permissions:
id-token: write
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Resolve new version
id: resolve-new-version
run: |
if [ -n "${{ inputs.version-override }}" ]; then
echo "NEW_VERSION=${{ inputs.version-override }}" >> "$GITHUB_OUTPUT"
exit 0
fi
CURRENT_VERSION=$(git tag --sort=-creatordate | head -n 1)
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
PATCH_NUMBER=${PATCH%%[^0-9]*}
PATCH_SUFFIX=${PATCH#$PATCH_NUMBER}
((PATCH_NUMBER++))
echo "NEW_VERSION=$MAJOR.$MINOR.$PATCH_NUMBER$PATCH_SUFFIX" >> "$GITHUB_OUTPUT"
- name: Create new version tag
env:
NEW_VERSION: ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
run: |
git config user.name aws-sdk-kotlin-ci
git config user.email "[email protected]"
git tag "$NEW_VERSION"
git push origin "$NEW_VERSION"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PUBLISHING_ROLE_ARN }}
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
uses: ./.github/actions/version-bump-pr
with:
repo: 'aws/aws-sdk-kotlin'
version: ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
pat: ${{ secrets.CI_USER_PAT }}
- name: Smithy Kotlin pull request
uses: ./.github/actions/version-bump-pr
with:
repo: 'smithy-lang/smithy-kotlin'
version: ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
pat: ${{ secrets.CI_USER_PAT }}
- name: CRT Kotlin pull request
uses: ./.github/actions/version-bump-pr
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() && steps.release-job.outcome != 'success' }}
run: |
git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }}