-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (65 loc) · 2.2 KB
/
ci.yml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: CI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }} @ ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B test --file pom.xml
publish:
name: Publish Artifacts
needs: [ build ]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java (temurin@17)
id: setup-java-temurin-17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
# Store the version, stripping any v-prefix
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: set version
run: |
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false
- name: Release Maven package
uses: WasiqB/maven-publish-action@v2
with:
server_id: sonatype
maven_profiles: release
gpg_private_key: ${{ secrets.PGP_SECRET }}
gpg_passphrase: ${{ secrets.PGP_PASSPHRASE }}
server_username: ${{ secrets.SONATYPE_USERNAME }}
server_password: ${{ secrets.SONATYPE_PASSWORD }}