-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.5 KB
/
build.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
77
78
79
80
81
name: spt-development-cid-jms-spring
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 23
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: 23
- name: Run Maven
run: ./mvnw clean install -Pall-quality-gates -B
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up JDK 23
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: 23
- name: Determine version
run: echo "POM_VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | sed -e 's/-SNAPSHOT//')" >> $GITHUB_ENV
- name: Import GPG key
id: import_gpg
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Configure Git User for updating version
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Create release
run: ./mvnw --settings .github/maven-settings.xml release:prepare release:perform -DskipTests -Prelease -B
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
GIT_HUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create GitHub release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.POM_VERSION }}
artifacts: target/spt-development-cid-jms-spring-${{ env.POM_VERSION }}.jar
artifactContentType: application/java-archive
bodyFile: documentation/releases/release-${{ env.POM_VERSION }}.md