-
Notifications
You must be signed in to change notification settings - Fork 88
59 lines (57 loc) · 2.16 KB
/
pre-release-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
name: Pre-release CI
on:
release:
types: [prereleased]
jobs:
build:
name: Pre-release CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Deploy pre-release version to GitHub Packages
run: |
pre_release_version=${{ github.event.release.tag_name }}
echo Pre-release version $pre_release_version
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
mvn versions:commit
mvn clean deploy -Pdeploy2Github -B -V
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Deploy pre-release version to the Maven Central Repository
run: |
pre_release_version=${{ github.event.release.tag_name }}
echo Pre-release version $pre_release_version
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
mvn versions:commit
mvn deploy -Pdeploy2Maven -DskipTests -B -V
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Rollback pre-release (remove tag)
if: failure()
run: git push origin :refs/tags/${{ github.event.release.tag_name }}