From 9513d2525065e1a0293cd6765248fa4bd45a1ca2 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Wed, 2 Aug 2023 11:38:49 +0200 Subject: [PATCH 1/5] Add scmVersion property Signed-off-by: Heiko Kiesel --- build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 58c7cd41..1e2575f4 100644 --- a/build.gradle +++ b/build.gradle @@ -16,9 +16,17 @@ plugins { } group 'io.securecodebox' -version = scmVersion.version sourceCompatibility = '17' +scmVersion { + tag { + prefix.set('') // Remove the plugin's default "v" tag prefix + } + + useHighestVersion.set(true) // https://axion-release-plugin.readthedocs.io/en/latest/configuration/version/#tag-with-the-highest-version +} +version = scmVersion.version + repositories { mavenCentral() } From 4b877fd2615d36a366efb405471fe59328d250a4 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Wed, 2 Aug 2023 11:42:05 +0200 Subject: [PATCH 2/5] Fetch tags as a precaution Signed-off-by: Heiko Kiesel --- .github/workflows/release.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 962e6669..ae44b080 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,9 @@ jobs: with: fetch-depth: 0 + - name: "Fetch git tags" # Required for axion-release-plugin + run: git fetch --tags + - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -60,6 +63,9 @@ jobs: fetch-depth: 0 ref: refs/tags/${{ needs.github.outputs.VERSION }} + - name: "Fetch git tags" # Required for axion-release-plugin + run: git fetch --tags + - name: Set up JDK 17 uses: actions/setup-java@v3 with: From cc133677863632d9426aac17fc6ab291ccb80a51 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Wed, 2 Aug 2023 11:43:51 +0200 Subject: [PATCH 3/5] Print release version Signed-off-by: Heiko Kiesel --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae44b080..e6aef9f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,9 +46,12 @@ jobs: git config user.email 'github-actions[bot]@users.noreply.github.com' ./gradlew release + - name: Show post-release version + run: ./gradlew currentVersion + # The previous "Release new version" step increases the version. We need this version for the publishing job. The # currentVersion command gets this value, which we store in the "version" variable for following jobs. - - name: Get current version + - name: Store version id: version run: echo "VERSION=$(./gradlew -q -Prelease.quiet currentVersion)" >> "$GITHUB_OUTPUT" From 3c38f0a12ecbf33504b24edb82d445c6a85f9c7c Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Wed, 2 Aug 2023 11:45:39 +0200 Subject: [PATCH 4/5] Clarify GITHUB_OUTPUT syntax Signed-off-by: Heiko Kiesel --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6aef9f3..2c73da7c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,8 @@ jobs: # The previous "Release new version" step increases the version. We need this version for the publishing job. The # currentVersion command gets this value, which we store in the "version" variable for following jobs. + # The $GITHUB_OUTPUT is a github-magic "file", it is accessible with needs.github.outputs.[variable-name], in our + # case: needs.github.outputs.version - name: Store version id: version run: echo "VERSION=$(./gradlew -q -Prelease.quiet currentVersion)" >> "$GITHUB_OUTPUT" From 78c4c69d77c4441c26a22cea75ce6f2686410319 Mon Sep 17 00:00:00 2001 From: Heiko Kiesel Date: Wed, 2 Aug 2023 13:50:18 +0200 Subject: [PATCH 5/5] Add explanations for fetch-depth and ref attributes Signed-off-by: Heiko Kiesel --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c73da7c..32556ba1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 # TODO: with... bot? with: - fetch-depth: 0 + fetch-depth: 0 # Due to https://axion-release-plugin.readthedocs.io/en/latest/configuration/ci_servers/#github-actions - name: "Fetch git tags" # Required for axion-release-plugin run: git fetch --tags @@ -65,8 +65,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 with: - fetch-depth: 0 - ref: refs/tags/${{ needs.github.outputs.VERSION }} + fetch-depth: 0 # Due to https://axion-release-plugin.readthedocs.io/en/latest/configuration/ci_servers/#github-actions + ref: refs/tags/${{ needs.github.outputs.VERSION }} # Checkout the new created tag - name: "Fetch git tags" # Required for axion-release-plugin run: git fetch --tags