Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0f438ba
feat: release workflow
0marperez May 15, 2025
08a93fb
fix syntax errors
0marperez May 15, 2025
a4cf081
fetch tags
0marperez May 15, 2025
200fd43
fetch origin instead ?
0marperez May 15, 2025
f0e45e4
fetch origin and tags
0marperez May 15, 2025
5972cf9
try fetch depth 0
0marperez May 15, 2025
a5bd704
debugging
0marperez May 15, 2025
c14127b
change way to get latest tag
0marperez May 15, 2025
7a3758c
dry run release
0marperez May 15, 2025
f2b0189
try run actual release
0marperez May 15, 2025
cc42b4a
configure gradle and aws credentials
0marperez May 15, 2025
7d554fb
configure OIDC
0marperez May 15, 2025
0cb4dc9
trigger CI?
0marperez May 15, 2025
ae6f560
give back write pemissions
0marperez May 15, 2025
c47bd2f
fix credentials?
0marperez May 15, 2025
26f0428
fix head object call
0marperez May 15, 2025
180fa6f
prepare for review
0marperez May 15, 2025
d6b7610
test codebuild invocation
0marperez May 15, 2025
3d1dc93
add pull request trigger
0marperez May 15, 2025
5054267
revert release script to original
0marperez May 15, 2025
1c1f12e
get ready for review
0marperez May 15, 2025
1a6e6e3
add back newlines
0marperez May 15, 2025
86722b5
test syntax for separate kn and regular releases
0marperez May 16, 2025
df8de1b
remove test code
0marperez May 16, 2025
ebe6569
update release instructions
0marperez May 19, 2025
faa983d
cleanup and test
0marperez Jun 17, 2025
72437a9
debug patch issues
0marperez Jun 17, 2025
2148fd4
fix issues and test
0marperez Jun 17, 2025
eaf34d0
fix issues and test v2
0marperez Jun 17, 2025
536f5c7
remove test code
0marperez Jun 17, 2025
432b581
remove test code v2
0marperez Jun 17, 2025
19f22e4
pr review fixes
0marperez Jun 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/run-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Release

on:
workflow_dispatch:
inputs:
version-override:
type: string
required: false
description: 'Optionally specify a custom release version (minor version bump e.g.)'
kn-release:
type: boolean
required: false
default: false
description: 'Whether the release is a KN variant of repo tools or not'

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

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

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
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: Delete failed release tag
if: ${{ failure() }}
run: |
git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@ version that is being released.

To cut a new release:

1. Go to this repo's GitHub actions.
2. Locate the release workflow.
3. Specify whether the release will be of a kn variant (used for Kotlin Native development).
4. If you're doing a minor or major version bump, specify the version override (including "-kn" if a kn variant).
5. Run the workflow.

The workflow will create a tag, push it to this repo and then start a
CodeBuild release job hosted in the shared tools account (e.g. `publish-aws-kotlin-repo-tools`).

<details>
<summary>Old manual release instructions</summary>

1. Create a new tag, e.g. `git tag x.y.z`.
2. Push the tag up `git push origin x.y.z`.
3. Go to the CodeBuild release job hosted in the shared tools account (e.g. `publish-aws-kotlin-repo-tools`).
4. Start a build with overrides.
5. Under `Source` connect your GitHub account (Under `Source` -> `Connection Status` you should see "You are connected to GitHub").
7. Specify the tag you created under `Source Version`.
8. Start the build.
6. Specify the tag you created under `Source Version`.
7. Start the build.

</details>

## Development

Expand Down
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export AWS_SECRET_ACCESS_KEY=$(echo "${SESSION_CREDS}" | jq -r '.Credentials.Sec
export AWS_SESSION_TOKEN=$(echo "${SESSION_CREDS}" | jq -r '.Credentials.SessionToken')
export RELEASE_S3_URL="s3://$RELEASE_BUCKET/releases"

TEST_KEY="releases/aws/sdk/kotlin/build-plugins/$VERSION/build-plugins-$VERSION.jar"
TEST_KEY="releases/aws/sdk/kotlin/gradle/build-support/$VERSION/build-support-$VERSION.jar"

if aws s3api head-object --bucket $RELEASE_BUCKET --key $TEST_KEY; then
echo "failing release; $VERSION already exists!"
Expand Down