Skip to content

Commit

Permalink
Replace action-read-yaml with $GITHUB_ENV in GitHub actions
Browse files Browse the repository at this point in the history
The Java configuration (e.g. version) is exteranlised to a properties file, which is YAML parsed via a third-party action.

[It was identified](hazelcast/hazelcast-packaging#204 (comment)) that this operation was possible without using a third-party action using `$GITHUB_ENV`.

For consistency, everywhere should use the same parsing logic.
  • Loading branch information
JackPGreen committed May 24, 2024
1 parent 3554206 commit 016d479
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/java-config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
JAVA_VERSION=17
JAVA_DISTRIBUTION=temurin
2 changes: 0 additions & 2 deletions .github/java-config.yml

This file was deleted.

9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Read Java Config
uses: pietrobolcato/action-read-yaml@9f13718d61111b69f30ab4ac683e67a56d254e1d
id: java-config
with:
config: ${{ github.workspace }}/.github/java-config.yml
run: cat ${{ github.workspace }}/.github/java-config.env >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ steps.java-config.outputs['java-version'] }}
java-version: ${{ env.JAVA_VERSION }}
architecture: 'x64'
distribution: ${{ steps.java-config.outputs['distribution'] }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
cache: 'maven'

- name: Build with Maven
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@ jobs:
ref: ${{ github.event.inputs.release-branch }}
token: ${{ secrets.GH_PAT }}
- name: Read Java Config
uses: pietrobolcato/action-read-yaml@9f13718d61111b69f30ab4ac683e67a56d254e1d
id: java-config
with:
config: ${{ github.workspace }}/.github/java-config.yml
run: cat ${{ github.workspace }}/.github/java-config.env >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ steps.java-config.outputs['java-version'] }}
distribution: ${{ steps.java-config.outputs['distribution'] }}
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
server-id: deploy-repository
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Read Java Config
uses: pietrobolcato/action-read-yaml@9f13718d61111b69f30ab4ac683e67a56d254e1d
id: java-config
with:
config: ${{ github.workspace }}/.github/java-config.yml
run: cat ${{ github.workspace }}/.github/java-config.env >> $GITHUB_ENV
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ steps.java-config.outputs['java-version'] }}
distribution: ${{ steps.java-config.outputs['distribution'] }}
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}
server-id: deploy-repository
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down

0 comments on commit 016d479

Please sign in to comment.