From 3516c284990fe78d8fcb9b16f10e59b042af1526 Mon Sep 17 00:00:00 2001 From: Nick Ebbitt Date: Tue, 17 Mar 2020 12:31:34 +0000 Subject: [PATCH] Pass version between workflow steps --- .github/workflows/publish-release.yml | 4 +++- build.gradle.kts | 17 ++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 1a6b7a9..ceadd5e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -19,6 +19,7 @@ jobs: java-version: 1.8 - name: Publish artifact + id: publish-artifact env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The GITHUB_REF tag comes in the format 'refs/tags/xxx'. @@ -28,6 +29,7 @@ jobs: echo "New version: ${NEW_VERSION}" echo "Github username: ${GITHUB_ACTOR}" ./gradlew -Pversion=${NEW_VERSION} publish + echo "::set-output name=new_version::${NEW_VERSION}" - name: Create Release id: create-release @@ -47,6 +49,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./build/libs/chaos-kraken-0.0.1-SNAPSHOT.jar + asset_path: ./build/libs/chaos-kraken-${{ steps.publish-artifact.outputs.new_version }}.jar asset_name: chaos-kraken.jar asset_content_type: application/jar diff --git a/build.gradle.kts b/build.gradle.kts index d75cc98..1981772 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -73,14 +73,13 @@ publishing { } repositories { -// maven { -// name = "GitHubPackages" -// url = uri("https://maven.pkg.github.com/autotraderuk/chaos-kraken") -// credentials { -// username = System.getenv("GITHUB_ACTOR") -// password = System.getenv("GITHUB_TOKEN") -// } -// } - mavenLocal() + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/autotraderuk/chaos-kraken") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } } }