-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (56 loc) · 1.83 KB
/
commit-stage.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
name: Commit Stage
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Compile and test
run: ./gradlew build -Dorg.gradle.parallel=false
- name: Generate SBOMs
run: ./gradlew cyclonedxBom
- name: Stage artifacts to local directory
if: ${{ github.ref == 'refs/heads/main' }}
run: ./gradlew publish
- name: Deploy and release artifacts
if: ${{ github.ref == 'refs/heads/main' }}
run: |
VERSION=$(./gradlew properties | grep 'version:' | awk '{print $2}')
if [[ $VERSION == *"SNAPSHOT"* ]]; then
./gradlew jreleaserDeploy
else
./gradlew jreleaserFullRelease
fi
env:
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-output
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties