forked from OliverO2/kmdc
-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (212 loc) · 7.21 KB
/
Copy pathrelease.yml
File metadata and controls
239 lines (212 loc) · 7.21 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Release
on:
workflow_dispatch:
inputs:
version:
required: true
description: Package version to publish under
skipPages:
description: Should we skip releasing GitHub pages
required: false
default: "y"
skipMavenCentral:
description: Should we skip publishing artefacts to Maven Central
required: false
default: "y"
skipGitHub:
description: Should we skip publishing artefacts to GitHub Packages
required: false
default: "y"
release:
types: [ created ]
env:
VERSION: ${{ github.event.release.tag_name }}
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
jobs:
build:
name: Build on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}
strategy:
fail-fast: false
matrix:
os:
# - runner: macos-latest
# shell: bash
# - runner: windows-latest
# shell: msys2 {0}
- runner: ubuntu-latest
shell: bash
steps:
- uses: msys2/setup-msys2@v2
if: ${{ runner.os == 'Windows' }}
with:
msystem: MINGW64
update: true
path-type: inherit
install: >-
tar
make
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-extra-cmake-modules
mingw64/mingw-w64-x86_64-cyrus-sasl
- uses: actions/checkout@v2
- name: Restore native cache
id: cache-native
uses: actions/cache@v2.1.7
with:
path: |
scripts/build
key: ${{ runner.os }}-native-${{ hashFiles('./scripts/*') }}
- name: Setup native libraries
run: ./scripts/setup.sh
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
id: cache-gradle
uses: actions/cache@v2.1.7
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Resolve Version
run: |
VERSION=${VERSION:=${{ github.event.inputs.version }}}
echo "VERSION=${VERSION/v}" >> $GITHUB_ENV
- name: Gradle Assemble Publications
run: ./gradlew publishToMavenLocal --scan
- name: Gradle Check
run: ./gradlew check --scan
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: publications-${{ runner.os }}
path: |
**/build/publications
**/build/libs
**/build/reports
- name: Gradle Assemble Dokka
if: ${{ runner.os == 'Linux' }}
run: ./gradlew dokkaHtmlMultiModule -Pversion=${VERSION//v} --scan
- uses: actions/upload-artifact@v2
if: ${{ runner.os == 'Linux' }}
with:
name: dokka
path: |
**/build/dokka
release-Artefacts:
name: Release to ${{ matrix.repository.name }} on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
needs: [ build ]
defaults:
run:
shell: ${{ matrix.os.shell }}
env:
GH_USERNAME: ${{ github.actor }}
GH_PASSWORD: ${{ github.token }}
strategy:
matrix:
repository:
- name: Github Packages
tasks: publishAllPublicationsToGitHubRepository
enabled: ${{ github.event.inputs.skipGitHub != 'y' }}
- name: Maven Central
# Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories
# If you're brave, you could change it to `publishToSonatype closeAndReleaseSonatypeStagingRepository` to fully automate the release
tasks: publishToSonatype closeSonatypeStagingRepository
enabled: ${{ github.event.inputs.skipMavenCentral != 'y' }}
os:
# - runner: macos-latest
# shell: bash
# - runner: windows-latest
# shell: msys2 {0}
- runner: ubuntu-latest
shell: bash
steps:
- uses: msys2/setup-msys2@v2
if: ${{ matrix.repository.enabled == true && runner.os == 'Windows' }}
with:
msystem: MINGW64
update: true
path-type: inherit
install: >-
tar
- name: Restore native cache
if: ${{ matrix.repository.enabled == true }}
id: cache-native
uses: actions/cache@v2.1.7
with:
path: |
scripts/build
key: ${{ runner.os }}-native-${{ hashFiles('./scripts/*') }}
- uses: actions/checkout@v2
if: ${{ matrix.repository.enabled == true }}
- name: Setup native libraries
if: ${{ matrix.repository.enabled == true }}
run: ./scripts/setup.sh
- uses: actions/setup-java@v2
if: ${{ matrix.repository.enabled == true }}
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
if: ${{ matrix.repository.enabled == true }}
id: cache-gradle
uses: actions/cache@v2.1.7
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- uses: actions/download-artifact@v2
if: ${{ matrix.repository.enabled == true }}
with:
name: publications-${{ runner.os }}
- name: Resolve Version
if: ${{ matrix.repository.enabled == true }}
run: |
VERSION=${VERSION:=${{ github.event.inputs.version }}}
echo "VERSION=${VERSION/v}" >> $GITHUB_ENV
- name: Gradle Publish to ${{ matrix.repository.name }}
if: ${{ matrix.repository.enabled == true }}
run: ./gradlew ${{ matrix.repository.tasks }} -Pversion=${VERSION//v} --scan
release-Dokka:
runs-on: ubuntu-latest
needs: [ build ]
if: ${{ github.event.inputs.skipPages != 'y' }}
steps:
- uses: actions/download-artifact@v2
with:
name: dokka
- name: Resolve Version
run: |
VERSION=${VERSION:=${{ github.event.inputs.version }}}
echo "VERSION=${VERSION/v}" >> $GITHUB_ENV
- name: Build Dokka Pages
run: |
REPO_NAME=${{ github.repository }}
REPO_NAME=${REPO_NAME#${{ github.repository_owner }}/}
cp -avr build/dokka/htmlMultiModule/ public;
find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
echo "/${REPO_NAME} /${REPO_NAME}/${REPO_NAME}/index.html 301" > public/_redirects;
echo "/${REPO_NAME}/index.html /${REPO_NAME}/${REPO_NAME}/index.html 301" >> public/_redirects;
- uses: crazy-max/ghaction-github-pages@v2.6.0
with:
target_branch: gh-pages
build_dir: public
env:
GITHUB_TOKEN: ${{ github.token }}