-
Notifications
You must be signed in to change notification settings - Fork 6
103 lines (84 loc) · 3.36 KB
/
main.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
93
94
95
96
97
98
99
100
101
102
103
name: Build and Deploy
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [ "published" ]
permissions:
contents: write
packages: write
# cancel in progress jobs or runs for the current workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build-jar:
name: jar / ${{ matrix.os }} / ${{ matrix.jdk-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
jdk-version: [ 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v3
- name: Set Up JDK ${{ matrix.jdk-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk-version }}
distribution: 'temurin'
server-id: 'ossrh' # id nexus-staging-maven-plugin
server-username: OSSRH_USERNAME # env name for nexus-staging-maven-plugin user var
server-password: OSSRH_PASSWORD # env name for nexus-staging-maven-plugin pass var
- name: Set Up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.8
- name: Cache Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup Maven Revision
shell: bash
run: echo "project_revision=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Update Maven Revision As Snapshot
if: github.event_name != 'release'
shell: bash
run: echo "project_revision=${{ env.project_revision }}-${GITHUB_SHA::6}-SNAPSHOT" >> $GITHUB_ENV
- name: Maven Build and Verify Jar
run: mvn -V -B -e -ff -ntp -P github,release-sign-artifacts -Drevision="${{ env.project_revision }}" clean verify
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: runner.os == 'Linux'
continue-on-error: true
with:
name: LitFX-${{ env.project_revision }}
path: |
./**/target/*.pom
./**/target/*.jar
./**/target/*.asc
retention-days: 10
if-no-files-found: error
- name: Deploy Github Package
if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || github.event_name == 'release')
continue-on-error: true
# LitFX is an invalid artifactId per GH Packages, using -fn to allow others to upload
run: mvn -V -B -e -fn -ntp -P github,release-sign-artifacts -Drevision="${{ env.project_revision }}" deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy OSSRH Package
if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || github.event_name == 'release')
run: mvn -V -B -e -ff -ntp -P ossrh,release-sign-artifacts -Drevision=${{ env.project_revision }} deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}