-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (80 loc) · 2.68 KB
/
maven-release.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
82
83
84
85
86
87
88
89
90
91
92
name: Release to Maven Central
on:
push:
tags:
- '*'
jobs:
tests:
runs-on: ubuntu-20.04
container: wirebot/cryptobox:1.4.0
# enable postgres
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Environment Variables
run: |
echo "POSTGRES_USER=postgres" >> $GITHUB_ENV
echo "POSTGRES_PASSWORD=postgres" >> $GITHUB_ENV
echo "POSTGRES_URL=postgres:5432/postgres" >> $GITHUB_ENV
- name: Execute Tests
run: |
mvn test -DargLine="-Djava.library.path=$LD_LIBRARY_PATH"
- name: Try to create package
run: |
mvn package -DskipTests
- name: Webhook to Wire
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Xenon - test execution before release
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_RELEASE }}
if: failure()
release:
needs: [ tests ]
name: Release on Sonatype OSS
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
- name: Build with Maven
run: mvn -DskipTests package
- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
distribution: 'temurin'
java-version: 11
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Apache Maven Central
run: mvn -DskipTests deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_OPTS: "--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Xenon - Release to Maven Central
env:
SLACK_WEBHOOK_URL: ${{ secrets.WEBHOOK_RELEASE }}
# Send message only if previous step failed
if: always()