From d20ec6a79c8560d586a2714e2fd65f4c60a5ade6 Mon Sep 17 00:00:00 2001 From: Omar Saad Date: Fri, 30 Apr 2021 00:49:44 +0200 Subject: [PATCH 1/6] feat: now automatically generates a tag and whatnot --- .github/workflows/release.yml | 24 +++++++++++++++--------- build.gradle.kts | 5 ++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44b620e..95cd33b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,6 @@ name: Release on: push: branches: [ $default-branch ] - tags: - - 'v*' jobs: build: @@ -24,11 +22,19 @@ jobs: - name: Build and test run: ./gradlew build - - name: Tag name and copy jar + - name: Get version + id: version + run: echo ::set-output name=version::v$(./gradlew -q getVersion).${{ github.run_number }} + + - name: Push tag + uses: anothrNick/github-tag-action@1.26.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CUSTOM_TAG: ${{ steps.version.outputs.version }} + + - name: Copy jar id: names - run: | - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} - cp build/libs/RedstoneTools*.jar asset.jar + run: cp build/libs/RedstoneTools*.jar asset.jar - name: Create release id: create_release @@ -36,8 +42,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref }} - name: ${{ steps.names.outputs.tag }} + tag_name: ${{ steps.version.outputs.version }} + release_name: ${{ steps.version.outputs.version }} draft: false prerelease: false @@ -48,5 +54,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: asset.jar - asset_name: RedstoneTools-${{ steps.names.outputs.tag }}.jar + asset_name: RedstoneTools-${{ steps.version.outputs.version }}.jar asset_content_type: application/java-archive diff --git a/build.gradle.kts b/build.gradle.kts index f98649e..bed5d75 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.ByteArrayOutputStream group = "" -version = execute("git", "describe", "--long", "--dirty") +version = "1.2" plugins { val kotlinVersion = "1.4.21" @@ -67,6 +67,9 @@ tasks.build { dependsOn(tasks.shadowJar) } +tasks.register("getVersion") { + println(version) +} fun execute(vararg command: String): String = ByteArrayOutputStream() .also { output -> From 8794b09069bff6b3035fc4c21b333bea1c78b20a Mon Sep 17 00:00:00 2001 From: Omar Saad Date: Fri, 30 Apr 2021 00:50:57 +0200 Subject: [PATCH 2/6] debug: running action --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95cd33b..3b3b6eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: id: version run: echo ::set-output name=version::v$(./gradlew -q getVersion).${{ github.run_number }} - - name: Push tag + - name: Push new tag uses: anothrNick/github-tag-action@1.26.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c215231c8bdf4836b9f1d6e106bc257cdc5d9270 Mon Sep 17 00:00:00 2001 From: Omar Saad Date: Fri, 30 Apr 2021 00:53:35 +0200 Subject: [PATCH 3/6] debug: added manual trigger --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b3b6eb..8a1c15d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ name: Release on: + workflow_dispatch: push: branches: [ $default-branch ] From 44890022a2f6235741573078a7664e42d0b05983 Mon Sep 17 00:00:00 2001 From: PabloDons Date: Thu, 13 May 2021 01:15:01 +0200 Subject: [PATCH 4/6] Set master branch explicitly Co-authored-by: Pauli Kauro <3965357+paulikauro@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a1c15d..d6511be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: workflow_dispatch: push: - branches: [ $default-branch ] + branches: [ master ] jobs: build: From 1a51ab0c04a272e3a06cbd58fa0a5cb9fde16ed2 Mon Sep 17 00:00:00 2001 From: Pauli Kauro <3965357+paulikauro@users.noreply.github.com> Date: Thu, 13 May 2021 02:27:11 +0300 Subject: [PATCH 5/6] Update .github/workflows/release.yml --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6511be..d7cd59a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,6 @@ jobs: CUSTOM_TAG: ${{ steps.version.outputs.version }} - name: Copy jar - id: names run: cp build/libs/RedstoneTools*.jar asset.jar - name: Create release From dcc3ce05aad5992d76d1a6a617290c31e9e2f268 Mon Sep 17 00:00:00 2001 From: Pauli Kauro <3965357+paulikauro@users.noreply.github.com> Date: Thu, 13 May 2021 02:43:40 +0300 Subject: [PATCH 6/6] Update build.gradle.kts --- build.gradle.kts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index bed5d75..f2ee8a7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,10 +71,3 @@ tasks.register("getVersion") { println(version) } -fun execute(vararg command: String): String = ByteArrayOutputStream() - .also { output -> - project.exec { - commandLine = command.toList() - standardOutput = output - } - }.toString().trim()