Skip to content

Commit 89664e7

Browse files
committed
Conditional snapshot deploy
1 parent 36a489e commit 89664e7

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,31 @@ jobs:
2929
- name: Run tests
3030
run: mvn test --file pom.xml
3131

32+
version:
33+
34+
needs: test
35+
36+
runs-on: ubuntu-latest
37+
38+
outputs:
39+
approved: ${{ steps.version.outputs.version }}
40+
41+
steps:
42+
- uses: actions/checkout@v2
43+
- name: Set up JDK 11
44+
uses: actions/setup-java@v5
45+
with:
46+
distribution: 'temurin'
47+
java-version: 11
48+
cache: 'maven'
49+
- name: version
50+
run: |
51+
mvn help:evaluate -Dexpression=project.version -q -DforceStdout >> $JCODINGS_VERSION
52+
echo "version=$JCODINGS_VERSION" >> $GITHUB_OUTPUT
3253
3354
snapshot:
3455

35-
needs: test
56+
needs: [test, version]
3657

3758
runs-on: ubuntu-latest
3859

@@ -48,8 +69,8 @@ jobs:
4869
server-username: MAVEN_USERNAME
4970
server-password: MAVEN_PASSWORD
5071
- name: Publish package
51-
run: mvn -B deploy
72+
run: mvn -ntp -B deploy
5273
env:
5374
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
5475
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
55-
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'jruby/jcodings' }}
76+
if: ${{ contains(jobs.version.outputs.version, 'SNAPSHOT') && github.ref == 'refs/heads/master' && github.repository == 'jruby/jcodings' }}

0 commit comments

Comments
 (0)