-
Notifications
You must be signed in to change notification settings - Fork 9
111 lines (96 loc) · 3.84 KB
/
build_test_deploy.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
name: GitHub Actions ACD Java SDK
on: [push, pull_request]
jobs:
build_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version:
- 8
- 11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Install Dependencies
run: mvn install
- name: Building Project
run: mvn clean compile
- name: Run Unit Tests
run: mvn verify -fae -DskipITs
- name: Report Status
run: echo "This job's status is ${{ job.status }}."
- name: Echo GitHub Ref
run: echo "The GitHub Ref is ${{ github.ref }}."
- name: Echo Commit Message
run: echo "The Commit Message is ${{ github.event.head_commit.message }}."
- name: Echo GitHub Event Name
run: echo "The GitHub Event name is ${{ github.event_name }}."
release:
runs-on: ubuntu-latest
needs: build_test
if: "github.event_name == 'push' && github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'chore')"
steps:
- name: Setup Extensions
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '18'
- name: Install Semantic Release dependencies
run: |
pip3 install --user bump2version
npm install -g semantic-release
npm install -g @semantic-release/changelog
npm install -g @semantic-release/exec
npm install -g @semantic-release/git
npm install -g @semantic-release/github
- name: Get the next release from semantic release
id: next_release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "NEXT_RELEASE=$(npx semantic-release --dry-run | grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+")" >> $GITHUB_OUTPUT
- name: Publish to git releases and tags
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "The next release is ${{ steps.next_release.outputs.NEXT_RELEASE }}"
npx semantic-release
- name: Publish to maven central
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
env:
GHA_TAG: "refs/tags/${{ steps.next_release.outputs.NEXT_RELEASE }}"
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
run: |
echo "The next release is ${{ steps.next_release.outputs.NEXT_RELEASE }}"
echo "Running script setupSigning"
build/setupSigning_gha.sh
echo "Running script setMavenVersion"
build/setMavenVersion_gha.sh
echo "Running mvn deploy"
mvn deploy --settings build/.travis.settings.xml -DskipITs -Dskip.unit-tests -P central
- name: Publish javadocs
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GHA_TAG: "refs/tags/${{ steps.next_release.outputs.NEXT_RELEASE }}"
GHA_COMMIT: ${{ github.sha }}
run: |
echo "Running script setMavenVersion"
build/setMavenVersion_gha.sh
echo "Running mvn clean"
mvn clean javadoc:aggregate
echo "Running script publish"
build/publishJavadoc_gha.sh