-
Notifications
You must be signed in to change notification settings - Fork 1
174 lines (157 loc) · 5.64 KB
/
release.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
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
name: Release
on:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
required: false
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:
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
jobs:
check:
uses: ./.github/workflows/check.yml
resolve-version:
uses: ./.github/workflows/resolve-version.yml
needs: [ check ]
with:
desired-version: ${{ github.event.release.tag_name || github.event.inputs.version }}
build:
name: Build Dokka
needs: [ check, resolve-version ]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
id: cache-gradle
uses: actions/cache@v3.0.11
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: Gradle Assemble Dokka
run: ./gradlew dokkaHtml -Pversion=${VERSION//v} --scan
- uses: actions/upload-artifact@v3
with:
name: dokka
path: |
**/build/dokka
release-Artefacts:
name: Release to ${{ matrix.repository.name }} on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
needs: [ check, resolve-version ]
defaults:
run:
shell: ${{ matrix.os.shell }}
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
GH_USERNAME: ${{ github.actor }}
GH_PASSWORD: ${{ github.token }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SECRET }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
strategy:
matrix:
repository:
- name: Github Packages
tasks: publishAllPublicationsToGitHubRepository
enabled: ${{ github.event.inputs.skipGitHub != 'y' }}
- name: Maven Central
# `closeSonatypeStagingRepository` Requires to manually release a new version on https://s01.oss.sonatype.org/#stagingRepositories
# If you're brave, you could change it to `closeAndReleaseSonatypeStagingRepository` to fully automate the release
tasks: publishToSonatype closeAndReleaseSonatypeStagingRepository
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:
release: false
msystem: MINGW64
update: true
path-type: inherit
install: >-
mingw-w64-x86_64-curl
curl
- uses: actions/checkout@v3.0.2
if: ${{ matrix.repository.enabled == true }}
- uses: actions/setup-java@v3
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@v3.0.11
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: 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, resolve-version ]
if: ${{ github.event.inputs.skipPages != 'y' && needs.resolve-version.outputs.snapshot == 'false' }}
env:
VERSION: ${{ needs.resolve-version.outputs.version }}
steps:
- uses: actions/download-artifact@v3
with:
name: dokka
- name: Build Dokka Pages
run: |
REPO_NAME=${{ github.repository }}
REPO_NAME=${REPO_NAME#${{ github.repository_owner }}/}
cp -avr build/dokka/html/ 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@v3.0.0
with:
target_branch: gh-pages
build_dir: public
env:
GITHUB_TOKEN: ${{ github.token }}