Skip to content

Commit 8f2427a

Browse files
authored
Merge pull request #76835 from margelo/@chrispader/add-java-version-file
[NoQA] chore: Add `.java-version` file for `jenv` and similar tools
2 parents 4665a58 + 0e236fc commit 8f2427a

File tree

6 files changed

+39
-6
lines changed

6 files changed

+39
-6
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Get Java version
2+
description: Reads the Java version from .java-version file
3+
4+
outputs:
5+
version:
6+
description: The Java version from .java-version file
7+
value: ${{ steps.getVersion.outputs.VERSION }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Get Java version
13+
id: getVersion
14+
shell: bash
15+
run: echo "VERSION=$(cat .java-version | tr -d '\n')" >> "$GITHUB_OUTPUT"
16+

.github/workflows/buildAndroid.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ jobs:
7575
- name: Setup Node
7676
uses: ./.github/actions/composite/setupNode
7777

78+
- name: Get Java version
79+
id: getJavaVersion
80+
uses: ./.github/actions/composite/getJavaVersion
81+
7882
- name: Setup Java
7983
# v4
8084
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
8185
with:
8286
distribution: oracle
83-
java-version: 17
87+
java-version: ${{ steps.getJavaVersion.outputs.version }}
8488

8589
- name: Setup Gradle
8690
# v4

.github/workflows/deploy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,16 @@ jobs:
109109
cd Mobile-Expensify
110110
npm run grunt:build:shared
111111
112+
- name: Get Java version
113+
id: getJavaVersion
114+
uses: ./.github/actions/composite/getJavaVersion
115+
112116
- name: Setup Java
113117
# v4
114118
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
115119
with:
116-
distribution: 'oracle'
117-
java-version: '17'
120+
distribution: oracle
121+
java-version: ${{ steps.getJavaVersion.outputs.version }}
118122

119123
- name: Setup Ruby
120124
# v1.229.0

.github/workflows/publishReactNativeAndroidArtifacts.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,15 @@ jobs:
148148
with:
149149
IS_HYBRID_BUILD: ${{ matrix.is_hybrid }}
150150

151+
- name: Get Java version
152+
id: getJavaVersion
153+
uses: ./.github/actions/composite/getJavaVersion
154+
151155
- name: Setup Java
152156
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
153157
with:
154158
distribution: oracle
155-
java-version: 17
159+
java-version: ${{ steps.getJavaVersion.outputs.version }}
156160

157161
- name: Setup Gradle
158162
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244

.github/workflows/testBuild.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,16 @@ jobs:
310310
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
311311
echo "APP_PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
312312
313+
- name: Get Java version
314+
id: getJavaVersion
315+
uses: ./.github/actions/composite/getJavaVersion
316+
313317
- name: Setup Java
314318
# v4
315319
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
316320
with:
317-
distribution: 'oracle'
318-
java-version: '17'
321+
distribution: oracle
322+
java-version: ${{ steps.getJavaVersion.outputs.version }}
319323

320324
- name: Setup Ruby
321325
# v1.229.0

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
17

0 commit comments

Comments
 (0)