Skip to content

Commit

Permalink
Split test/deploy in CI (#73)
Browse files Browse the repository at this point in the history
* Split test/deploy in CI
* Bump pom-scijava version
  • Loading branch information
ppouchin authored Jul 28, 2023
1 parent 66cce57 commit 171f5be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ name: Java CI with Maven
on: [ push, pull_request ]

jobs:
build:

test:
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -90,9 +89,32 @@ jobs:
path: |
target/*.jar
!target/*-with-dependencies.jar
deploy:
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Install gpg secret key
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: cat <(echo -e "${{ secrets.GPG_KEY }}") | gpg --batch --import
- name: Make sure to append 'SNAPSHOT' to version if 'push' happened on 'main'
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
mvn versions:set -DremoveSnapshot
mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
VERSION=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
mvn versions:set -DnewVersion=$VERSION-SNAPSHOT
- name: Publish to GitHub Packages Apache Maven
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: mvn deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -DskipTests -s $GITHUB_WORKSPACE/settings.xml
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>pom-scijava</artifactId>
<groupId>org.scijava</groupId>
<version>35.1.1</version>
<version>36.0.0</version>
</parent>

<groupId>fr.igred</groupId>
Expand Down

0 comments on commit 171f5be

Please sign in to comment.