Skip to content

Commit f6933fe

Browse files
committed
Tweak CI to only do test for non-releases
1 parent f0ca20c commit f6933fe

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ jobs:
3535
with:
3636
distribution: adopt-hotspot
3737
java-version: ${{ matrix.java-version }}
38-
38+
39+
# Check if a tag exists that matches the current project version.
40+
# Write the existence state to the step output 'tagExists'.
41+
- name: 'Check: package version has corresponding git tag'
42+
id: tagged
43+
shell: bash
44+
run: git show-ref --tags --verify --quiet -- "refs/tags/${{ env.JRELEASER_PROJECT_VERSION }}" && echo "tagExists=1" >> $GITHUB_OUTPUT || echo "tagExists=0" >> $GITHUB_OUTPUT
45+
3946
# Run tests & build artifact
40-
- name: Run tests & build release
47+
- name: Build
48+
if: steps.tagged.outputs.tagExists == 1
49+
run: ./mvnw test
50+
- name: Build release
51+
if: steps.tagged.outputs.tagExists == 0
4152
run: ./mvnw install -Prelease
4253

4354
# Upload test results
@@ -57,13 +68,6 @@ jobs:
5768
- name: Extract project version to environment variable
5869
run: echo "JRELEASER_PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
5970

60-
# Check if a tag exists that matches the current project version.
61-
# Write the existence state to the step output 'tagExists'.
62-
- name: 'Check: package version has corrosponding git tag'
63-
id: tagged
64-
shell: bash
65-
run: git show-ref --tags --verify --quiet -- "refs/tags/${{ env.JRELEASER_PROJECT_VERSION }}" && echo "tagExists=1" >> $GITHUB_OUTPUT || echo "tagExists=0" >> $GITHUB_OUTPUT
66-
6771
# Make release with JReleaser, only running when the project version does not exist as a tag on the repository.
6872
- name: Release
6973
if: steps.tagged.outputs.tagExists == 0

0 commit comments

Comments
 (0)