forked from hamnis/json-stat.java
-
Notifications
You must be signed in to change notification settings - Fork 8
58 lines (49 loc) · 1.67 KB
/
build_and_release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Build and release
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17' ]
name: Build on Java ${{ matrix.java }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn --batch-mode --no-transfer-progress package
release:
runs-on: ubuntu-latest
needs: build
name: Release on Java 11
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '11'
cache: 'maven'
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Resolve version and set version with Maven
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
export RELEASE_VERSION=${GITHUB_REF#refs/tags/}
else
export RELEASE_VERSION=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
mvn versions:set --no-transfer-progress -DnewVersion=$RELEASE_VERSION
- name: Deploy with Maven
run: mvn clean deploy --settings '.mvn/settings.xml' -P build-javadoc-and-sources,release -Dmaven.test.skip=true --batch-mode --no-transfer-progress
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}