Skip to content

Commit ca18ac0

Browse files
committed
pull from main
2 parents 0c2c5f0 + 9153b66 commit ca18ac0

File tree

9 files changed

+136
-16
lines changed

9 files changed

+136
-16
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Changelog Verification'
2+
description: 'Verifies that a PR includes a valid changelog entry'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Checkout sources
8+
uses: actions/checkout@v4
9+
10+
- name: Setup kat
11+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/setup-kat@main
12+
13+
- name: Check for new changelog entry
14+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
15+
shell: bash
16+
run: |
17+
git fetch origin ${{ github.base_ref }} --depth 1
18+
if ! git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/[0-9a-f-]+\.json"; then
19+
echo "::error ::No new/updated changelog entry found in /.changes directory. Please either:"
20+
echo "::error ::* Add a changelog entry (see CONTRIBUTING.md for instructions) or"
21+
echo "::error ::* Add the 'no-changelog' label to this PR (in rare cases not warranting a changelog entry)"
22+
exit 1
23+
fi
24+
25+
- name: Verify all changelogs
26+
shell: bash
27+
run: |
28+
if ! kat changelog ls; then
29+
echo "::error ::Changelog verification failed. Please check the format of your changelog entry."
30+
exit 1
31+
fi

.github/workflows/run-release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version-override:
7+
type: string
8+
required: false
9+
description: 'Optionally specify a custom release version (minor version bump e.g.)'
10+
kn-release:
11+
type: boolean
12+
required: false
13+
default: false
14+
description: 'Whether the release is a KN variant of repo tools or not'
15+
16+
permissions:
17+
id-token: write
18+
contents: write
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout source
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
fetch-tags: true
29+
30+
- name: Resolve new version
31+
id: resolve-new-version
32+
run: |
33+
if [ -n "${{ inputs.version-override }}" ]; then
34+
echo "NEW_VERSION=${{ inputs.version-override }}" >> "$GITHUB_OUTPUT"
35+
exit 0
36+
fi
37+
38+
if [ "${{ inputs.kn-release }}" == "true" ]; then
39+
CURRENT_VERSION=$(git tag --sort=-creatordate | grep -- '-kn$' | head -n 1)
40+
else
41+
CURRENT_VERSION=$(git tag --sort=-creatordate | grep -v -- '-kn$' | head -n 1)
42+
fi
43+
44+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
45+
PATCH_NUMBER=${PATCH%%[^0-9]*}
46+
PATCH_SUFFIX=${PATCH#$PATCH_NUMBER}
47+
((PATCH_NUMBER++))
48+
echo "NEW_VERSION=$MAJOR.$MINOR.$PATCH_NUMBER$PATCH_SUFFIX" >> "$GITHUB_OUTPUT"
49+
50+
- name: Create new version tag
51+
env:
52+
NEW_VERSION: ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
53+
run: |
54+
git config user.name aws-sdk-kotlin-ci
55+
git config user.email "[email protected]"
56+
git tag "$NEW_VERSION"
57+
git push origin "$NEW_VERSION"
58+
59+
- name: Configure AWS credentials
60+
uses: aws-actions/configure-aws-credentials@v4
61+
with:
62+
role-to-assume: ${{ secrets.PUBLISHING_ROLE_ARN }}
63+
aws-region: us-west-2
64+
65+
- name: Run codebuild release job
66+
uses: aws-actions/aws-codebuild-run-build@v1
67+
with:
68+
project-name: publish-aws-kotlin-repo-tools
69+
source-version-override: ${{ steps.resolve-new-version.outputs.NEW_VERSION }}
70+
71+
- name: Delete failed release tag
72+
if: ${{ failure() }}
73+
run: |
74+
git push --delete origin ${{ steps.resolve-new-version.outputs.NEW_VERSION }}

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @awslabs/aws-sdk-kotlin-sde

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,27 @@ version that is being released.
2020

2121
To cut a new release:
2222

23+
1. Go to this repo's GitHub actions.
24+
2. Locate the release workflow.
25+
3. Specify whether the release will be of a kn variant (used for Kotlin Native development).
26+
4. If you're doing a minor or major version bump, specify the version override (including "-kn" if a kn variant).
27+
5. Run the workflow.
28+
29+
The workflow will create a tag, push it to this repo and then start a
30+
CodeBuild release job hosted in the shared tools account (e.g. `publish-aws-kotlin-repo-tools`).
31+
32+
<details>
33+
<summary>Old manual release instructions</summary>
34+
2335
1. Create a new tag, e.g. `git tag x.y.z`.
2436
2. Push the tag up `git push origin x.y.z`.
2537
3. Go to the CodeBuild release job hosted in the shared tools account (e.g. `publish-aws-kotlin-repo-tools`).
2638
4. Start a build with overrides.
2739
5. Under `Source` connect your GitHub account (Under `Source` -> `Connection Status` you should see "You are connected to GitHub").
28-
7. Specify the tag you created under `Source Version`.
29-
8. Start the build.
40+
6. Specify the tag you created under `Source Version`.
41+
7. Start the build.
42+
43+
</details>
3044

3145
## Development
3246

build-plugins/build-support/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ dependencies {
2727
implementation(libs.nexusPublishPlugin)
2828
implementation(libs.jReleaserPlugin)
2929
compileOnly(gradleApi())
30-
implementation("aws.sdk.kotlin:s3:1.1.+")
31-
implementation("aws.sdk.kotlin:cloudwatch:1.1.+")
30+
implementation("aws.sdk.kotlin:s3:1.4.+")
31+
implementation("aws.sdk.kotlin:cloudwatch:1.4.+")
3232
testImplementation(libs.junit.jupiter)
3333
}
3434

build-plugins/build-support/src/main/kotlin/aws/sdk/kotlin/gradle/plugins/artifactsizemetrics/CollectDelegatedArtifactSizeMetrics.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ internal abstract class CollectDelegatedArtifactSizeMetrics : DefaultTask() {
6969
private fun getFiles(keys: List<String>): List<String> = runBlocking {
7070
S3Client.fromEnvironment().use { s3 ->
7171
keys.map { key ->
72-
async { s3.getObjectAsText(key) }
72+
async {
73+
s3.getObject(
74+
GetObjectRequest {
75+
bucket = S3_ARTIFACT_SIZE_METRICS_BUCKET
76+
this.key = key
77+
},
78+
) { it.body?.decodeToString() ?: throw AwsSdkGradleException("Metrics file $key is missing a body") }
79+
}
7380
}.awaitAll()
7481
}
7582
}
7683

77-
private suspend fun S3Client.getObjectAsText(objectKey: String) = getObject(
78-
GetObjectRequest {
79-
bucket = S3_ARTIFACT_SIZE_METRICS_BUCKET
80-
key = objectKey
81-
},
82-
) { it.body?.decodeToString() ?: throw AwsSdkGradleException("Metrics file $objectKey is missing a body") }
83-
8484
private fun combine(metricsFiles: List<String>) = buildString {
8585
appendLine("Artifact, Size")
8686
metricsFiles.forEach { metricsFile ->

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
ktlint = "1.3.0"
3-
smithy-version = "1.53.0"
4-
smithy-gradle-plugin-version = "1.1.0"
3+
smithy-version = "1.60.2"
4+
smithy-gradle-plugin-version = "1.3.0"
55
junit-version = "5.10.1"
66

77
[libraries]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

scripts/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export AWS_SECRET_ACCESS_KEY=$(echo "${SESSION_CREDS}" | jq -r '.Credentials.Sec
2020
export AWS_SESSION_TOKEN=$(echo "${SESSION_CREDS}" | jq -r '.Credentials.SessionToken')
2121
export RELEASE_S3_URL="s3://$RELEASE_BUCKET/releases"
2222

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

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

0 commit comments

Comments
 (0)