From a4231abb0a889f4d7749cf70bf8b20761a32689b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 15 Apr 2024 17:16:03 +0100 Subject: [PATCH] Polish GHA input and output handling --- .github/actions/build/action.yml | 4 +++- .github/workflows/build-and-deploy-snapshot.yml | 5 +++-- .github/workflows/ci.yml | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index f198726924d..c8dc182a3ea 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -29,7 +29,7 @@ inputs: description: 'The password for authentication with the remote build cache' outputs: build-scan-url: - value: ${{ steps.build.outputs.build-scan-url }} + value: ${{ (inputs.publish && steps.build-and-publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }} version: value: ${{ steps.read-version.outputs.version }} runs: @@ -62,6 +62,7 @@ runs: echo systemProp.org.gradle.java.installations.auto-download=false >> $HOME/.gradle/gradle.properties echo systemProp.org.gradle.java.installations.paths=${{ format('$JAVA_HOME_{0}_X64', inputs.java-version) }} >> $HOME/.gradle/gradle.properties - name: Build + id: build if: ${{ !inputs.publish }} shell: bash env: @@ -71,6 +72,7 @@ runs: GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ inputs.gradle-enterprise-cache-password }} run: ./gradlew build - name: Build and Publish + id: build-and-publish if: ${{ inputs.publish }} shell: bash env: diff --git a/.github/workflows/build-and-deploy-snapshot.yml b/.github/workflows/build-and-deploy-snapshot.yml index 32a725a627a..6a95f49523b 100644 --- a/.github/workflows/build-and-deploy-snapshot.yml +++ b/.github/workflows/build-and-deploy-snapshot.yml @@ -14,6 +14,7 @@ jobs: - name: Check Out Code uses: actions/checkout@v4 - name: Build and Publish + id: build-and-publish uses: ./.github/actions/build with: gradle-enterprise-secret-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} @@ -39,10 +40,10 @@ jobs: with: webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} status: ${{ job.status }} - build-scan-url: ${{ steps.build.outputs.build-scan-url }} + build-scan-url: ${{ steps.build-and-publish.outputs.build-scan-url }} run-name: ${{ format('{0} | Linux | Java 17', github.ref_name) }} outputs: - version: ${{ steps.build.outputs.version }} + version: ${{ steps.build-and-publish.outputs.version }} verify: name: Verify needs: build-and-deploy-snapshot diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82c0c9fd664..b95fcd2f4c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: - name: Check Out Code uses: actions/checkout@v4 - name: Build + id: build uses: ./.github/actions/build with: java-version: ${{ matrix.java.version }}