From 8ef224da521ed5ae849807c4a48d59fb630376f5 Mon Sep 17 00:00:00 2001 From: Brian Terczynski Date: Fri, 21 Jun 2024 15:59:36 -0700 Subject: [PATCH 1/2] Clean up release scripts in GitHub actions Having a hard time getting the release scripts to work with GitHub actions so going to clean up for now and just write up a manual process. May revisit an automated process for this later. --- .github/scripts/commit_release.sh | 24 ------------------- .github/scripts/tag_release.sh | 6 ----- .github/workflows/release.yml | 38 ------------------------------- scripts/release.sh | 29 ----------------------- 4 files changed, 97 deletions(-) delete mode 100755 .github/scripts/commit_release.sh delete mode 100644 .github/scripts/tag_release.sh delete mode 100644 .github/workflows/release.yml delete mode 100755 scripts/release.sh diff --git a/.github/scripts/commit_release.sh b/.github/scripts/commit_release.sh deleted file mode 100755 index 9218e96..0000000 --- a/.github/scripts/commit_release.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -x -e -o pipefail - -git checkout -b "release/$1" - -echo $2 - -# Update version in podspec. -# (Search podspec for `version = '1.2.3` and update with new version -# number passed in as script argument). -# -# Regex pattern adapted from -# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string -# for compatibility with sed. -sed -E -i "s/version *= *(["'"'"'])(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(0|[1-9][0-9]]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?["'"'"']/version = \1$1\1/g" library/build.gradle.kts - -# Commit changes and push. -git add --all -git config user.name "$2" -git config user.email "$2@users.noreply.github.com" -git commit -m "Release $1" -git push https://$GITHUB_TOKEN@github.com/thumbtack/kotlin-testing-tools.git $(git branch --show-current) -gh pr create --title "Release $1" --body "" --head $(git branch --show-current) diff --git a/.github/scripts/tag_release.sh b/.github/scripts/tag_release.sh deleted file mode 100644 index c41d082..0000000 --- a/.github/scripts/tag_release.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -git tag "$1" -git push --tags https://$GITHUB_TOKEN@github.com/thumbtack/kotlin-testing-tools.git diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index aa6d2b9..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release Kotlin Testing Tools -on: - workflow_dispatch: - inputs: - version: - description: 'Version number for new release (x.x.x)' - required: true -jobs: - release: - name: Create new Kotlin Testing Tools release - runs-on: ubuntu-latest - steps: - - name: 📥 Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - persist-credentials: false - - - name: ⬆️ Bump version in thumbprint/build.gradle.kts - run: bash .github/scripts/commit_release.sh "${{ github.event.inputs.version }}" "${{ github.actor }}" - env: - # When the default secrets.GITHUB_TOKEN is used to push the version bump branch, - # GitHub will not trigger the `push` event that triggers CI to run on that branch. - # To ensure that CI is still triggered, use a separate personal access token with - # [public_repo] scope. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 🏷 Create release tag - run: bash .github/scripts/tag_release.sh "${{ github.event.inputs.version }}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 🚀 Create GitHub release - uses: softprops/action-gh-release@v1 - with: - tag_name: "${{ github.event.inputs.version }}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 2cea9b8..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -if [ "$1" == "" ] -then - echo "Usage: release.sh " - exit 1 -fi - -git checkout -b "release/$1" - -# Update version in podspec. -# (Search podspec for `version = '1.2.3` and update with new version -# number passed in as script argument). -# -# Regex pattern adapted from -# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string -# for compatibility with sed. -sed -i "" -E "s/version *= *(["'"'"'])(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(0|[1-9][0-9]]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?["'"'"']/version = \1$1\1/g" library/build.gradle.kts - -# Commit changes and push. -git add --all -git commit -m "Release $1" -git push origin "$(git branch --show-current)" -git checkout main -git merge "release/$1" -git push origin main -git tag "$1" From 1b0bd85aa7f6f487fb699bf875243764bd6c0dbd Mon Sep 17 00:00:00 2001 From: Brian Terczynski Date: Fri, 21 Jun 2024 15:59:36 -0700 Subject: [PATCH 2/2] Clean up release scripts in GitHub actions Having a hard time getting the release scripts to work with GitHub actions so going to clean up for now and just write up a manual process. May revisit an automated process for this later. --- gradle/libs.versions.toml | 2 -- library/build.gradle.kts | 13 ++++++++++++- settings.gradle.kts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ecfec1a..e2a8b47 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,8 @@ [versions] kotlin = "2.0.0" -nexus-publish = "2.0.0-rc-1" [libraries] kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -nexus-publish = { module = "io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin", version.ref = "nexus-publish" } [plugins] kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } diff --git a/library/build.gradle.kts b/library/build.gradle.kts index fa25c8c..47c6363 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -55,9 +55,20 @@ kotlin { } } -// Create special release target that can handle special version label to local maven +// Create special release target that can handle special version label to local maven, +// and disable some publish*MavenLocal tasks so Jitpack doesn't generate a bunch of these afterEvaluate { val taskNames = this.gradle.startParameter.taskNames + + project.tasks.forEach { + if (it.name.contains("publishJvmPublicationToMavenLocal")) { + it.enabled = false + } + if (it.name.contains("publishKotlinMultiplatformPublicationToMavenLocal")) { + it.enabled = false + } + } + publishing { publications { create("Release") { diff --git a/settings.gradle.kts b/settings.gradle.kts index bc565d2..6f51a6e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,3 +15,4 @@ dependencyResolutionManagement { rootProject.name = "kotlin-testing-tools" include(":library") +findProject(":library")?.name = "kotlin-testing-tools"