-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (123 loc) · 3.7 KB
/
build-and-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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build & Deploy
on:
push:
paths-ignore:
- '.gitignore'
- '.mergify.yml'
- 'CHANGELOG.md'
- 'LICENSE'
- 'README.md'
- 'renovate.json'
pull_request:
jobs:
validation:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Validate the Gradle Wrapper
uses: gradle/wrapper-validation-action@v3.5.0
build:
needs:
- validation
strategy:
matrix:
os: [ ubuntu, macos, windows ]
java-version: [ 11, 17 ]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: adopt
- name: Run quality assurance and test with coverage
run: ./gradlew clean check
- name: CodeCov
if: ${{ contains('Linux', runner.os) }}
uses: codecov/codecov-action@v5.3.1
with:
directory: "build/reports/jacoco"
release-and-delivery:
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
# Allow only one release at a time.
group: release-and-delivery-${{ github.event.number || github.ref }}
needs:
- build
runs-on: ubuntu-latest
outputs:
release-status: ${{ env.release_status }}
# Release only where secrets are available.
if: >-
!github.event.repository.fork
&& (
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Find the version of Node from package.json
id: node-version
run: echo "version=$(jq -r .engines.node package.json)" >> $GITHUB_OUTPUT
- name: Install Node
uses: actions/setup-node@v4.2.0
with:
node-version: ${{ steps.node-version.outputs.version }}
- name: Release and container delivery
uses: AndreaGiulianelli/release-and-delivery-action@1.0.0
with:
should-release: true
release-command: |
npm install
npx semantic-release
should-build-and-deliver-container: false
github-token: ${{ secrets.GITHUB_TOKEN }}
documentation-deploy:
needs:
- release-and-delivery
permissions:
contents: write
runs-on: ubuntu-latest
if: needs.release-and-delivery.outputs.release-status == 'released'
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Generate and deploy documentation
uses: SmartOperatingBlock/documentation-ghp-action@1.1.0
with:
should-generate-code-documentation: true
code-documentation-generation-command: ./gradlew javadoc
code-documentation-dst-folder: './build/docs/javadoc'
code-documentation-site-folder: 'documentation/code-doc'
github-token: ${{ secrets.GITHUB_TOKEN }}
success:
runs-on: ubuntu-latest
needs:
- validation
- build
- release-and-delivery
- documentation-deploy
if: >-
always() && (
contains(join(needs.*.result, ','), 'failure')
|| !contains(join(needs.*.result, ','), 'cancelled')
)
steps:
- name: Verify that there were no failures
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}