Skip to content

Commit 845b71f

Browse files
committed
Conditionally deploy snapshots
1 parent 36a489e commit 845b71f

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,32 @@ jobs:
2727
java-version: ${{ matrix.java-version }}
2828
cache: 'maven'
2929
- name: Run tests
30-
run: mvn test --file pom.xml
30+
run: mvn -ntp test --file pom.xml
3131

32+
version:
33+
34+
needs: test
35+
36+
outputs:
37+
version: ${{ steps.version.outputs.version }}
38+
39+
runs-on: ubuntu-latest
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+
echo version=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout` >> $GITHUB_OUTPUT
3252
3353
snapshot:
3454

35-
needs: test
55+
needs: [test, version]
3656

3757
runs-on: ubuntu-latest
3858

@@ -48,8 +68,8 @@ jobs:
4868
server-username: MAVEN_USERNAME
4969
server-password: MAVEN_PASSWORD
5070
- name: Publish package
51-
run: mvn -B deploy
71+
run: mvn -ntp deploy
5272
env:
5373
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
5474
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
55-
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'jruby/jcodings' }}
75+
if: ${{ contains('SNAPSHOT', needs.version.outputs.version) && github.ref == 'refs/heads/master' && github.repository == 'jruby/jcodings' }}

0 commit comments

Comments
 (0)