-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (109 loc) · 4.83 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build and Publish
on:
push:
branches:
- 'master'
- 'feat/**'
- 'chore/**'
- 'fix/**'
pull_request:
branches:
- 'master'
jobs:
Build-and-Publish:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
submodules: 'recursive'
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: adopt-hotspot
java-version: 8
cache: maven
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: Set Version
id: set-version
run: echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT
- name: Print Version
run: echo "Version ${{ steps.set-version.outputs.version }}"
- name: Set test suite
if: ${{ github.ref != 'refs/heads/master' }}
run: echo "GITHUB_TEST_SUITE=UnitTestSuite" >> $GITHUB_ENV
- name: Compile
run: ./mvnw compile
- name: Verify
run: ./mvnw --batch-mode verify -Dtest=$GITHUB_TEST_SUITE -Danypoint.client.id=${{secrets.ANYPOINT_CLIENT_ID}} -Danypoint.client.secret=${{secrets.ANYPOINT_CLIENT_SECRET}} -Danypoint.connected-app.id=${{secrets.ANYPOINT_CONNECTED_APP_ID}} -Danypoint.connected-app.secret=${{secrets.ANYPOINT_CONNECTED_APP_SECRET}} -Danypoint.username=${{secrets.ANYPOINT_USERNAME}} -Danypoint.password=${{secrets.ANYPOINT_PASSWORD}}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ./*/target/surefire-reports/*.xml
- name: Publish to Maven Central
id: publish-to-maven-central
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master'}}
run: ./mvnw clean deploy -DskipTests -Drelease=true
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: JReleaser full-Release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
uses: jreleaser/release-action@v2
env:
JRELEASER_PROJECT_VERSION: ${{steps.set-version.outputs.version}}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
JRELEASER_VERSION: 1.6.0
with:
version: ${{ env.JRELEASER_VERSION }}
arguments: full-release
- name: JReleaser release output
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}
uses: actions/upload-artifact@v3
with:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
Perform-Release:
runs-on: ubuntu-latest
needs: Build-and-Publish
if: ${{ !contains(needs.Build-and-Publish.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
submodules: 'recursive'
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: adopt-hotspot
java-version: 8
cache: maven
- name: Increment Version
run: |
./mvnw clean build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT -DprocessAllModules versions:commit
- name: Set New Version Variable
id: set-new-version
run: echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
branch: "feat/v${{ steps.set-new-version.outputs.version }}"
commit-message: "[create-pull-request] Auto increment to v${{ steps.set-new-version.outputs.version }}"
title: "Auto increment to v${{ steps.set-new-version.outputs.version }}"
delete-branch: true
assignees: ${{ github.actor }}