Skip to content

Commit

Permalink
Pass encryption key as input to composite actions
Browse files Browse the repository at this point in the history
Because composite actions can't access secrets directly
  • Loading branch information
marcphilipp committed Nov 6, 2024
1 parent 216377b commit 6ba1f2b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/actions/main-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ inputs:
required: true
description: Gradle arguments
default: :platform-tooling-support-tests:test build --configuration-cache
encryptionKey:
required: true
description: Gradle cache encryption key
runs:
using: "composite"
steps:
- uses: ./.github/actions/setup-test-jdk
- uses: ./.github/actions/run-gradle
with:
arguments: ${{ inputs.arguments }}
encryptionKey: ${{ inputs.encryptionKey }}
5 changes: 4 additions & 1 deletion .github/actions/run-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
required: true
description: Gradle arguments
default: build
encryptionKey:
required: true
description: Gradle cache encryption key
runs:
using: "composite"
steps:
Expand All @@ -16,7 +19,7 @@ runs:
check-latest: true
- uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-encryption-key: ${{ inputs.encryptionKey }}
- shell: bash
env:
JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Build
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
--no-build-cache \
-Dscan.tag.CodeQL \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cross-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- name: Build
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
-PjavaToolchain.version=${{ matrix.jdk.version }} \
-Dscan.tag.JDK_${{ matrix.jdk.version }} \
Expand Down Expand Up @@ -93,6 +94,7 @@ jobs:
- name: Build
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
-PjavaToolchain.version=${{ matrix.jdk }} \
-PjavaToolchain.implementation=j9 \
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- name: Build
uses: ./.github/actions/main-build
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
-Ptesting.enableJaCoCo \
:platform-tooling-support-tests:test \
Expand All @@ -52,6 +53,8 @@ jobs:
fetch-depth: 1
- name: Build
uses: ./.github/actions/main-build
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

macOS:
runs-on: macos-latest
Expand All @@ -62,10 +65,12 @@ jobs:
fetch-depth: 1
- name: Build
uses: ./.github/actions/main-build
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

publish_artifacts:
name: Publish Snapshot Artifacts
needs: linux
needs: Linux
runs-on: ubuntu-latest
permissions:
attestations: write # required for build provenance attestation
Expand All @@ -82,6 +87,7 @@ jobs:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
publish -x check \
prepareGitHubAttestation
Expand Down Expand Up @@ -109,6 +115,7 @@ jobs:
- name: Build Documentation
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
prepareDocsForUploadToGhPages \
-Dscan.tag.Documentation
Expand All @@ -118,6 +125,7 @@ jobs:
permissions:
contents: write
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
gitPublishPush \
-Dscan.tag.Documentation
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/reproducible-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: Restore Gradle cache and display toolchains
uses: ./.github/actions/run-gradle
with:
encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
arguments: |
--quiet \
--configuration-cache
Expand Down

0 comments on commit 6ba1f2b

Please sign in to comment.