-
-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (148 loc) · 4.54 KB
/
publish-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
name: Publish Release
on:
push:
tags:
- v4.**.**
env:
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
OSSRH_USER: ${{ secrets.SONATYPE_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GRADLE_OPTS: "-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
jobs:
run-test-and-publish:
name: Run test and publish
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
# 检出仓库代码
- name: Check Out Repo
uses: actions/checkout@v4
# setup Java
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
cache: 'gradle'
# setup Gradle
- name: Gradle Run Test
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: assemble test -Porg.gradle.daemon=false
# setup Gradle
- name: Publish Release
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
publishToSonatype
closeAndReleaseStagingRepository
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
env:
SIMBOT_IS_SNAPSHOT: false
SIMBOT_RELEASES_ONLY: true
create-release:
name: Create release
runs-on: ubuntu-latest
needs: run-test-and-publish
permissions:
contents: write
steps:
# 检出仓库代码
- name: Check Out Repo
uses: actions/checkout@v4
# Create gitHub release
- name: Create Github Release
uses: softprops/[email protected]
with:
token: ${{ secrets.PUSH_TOKEN }}
body_path: .changelog/${{ github.ref_name }}.md
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'alpha') }}
# || contains(github.ref_name, 'beta')
publish-snapshot:
name: Publish snapshot
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
needs: run-test-and-publish
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v4
# setup Java
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
# setup Gradle
- name: Gradle publish snapshot
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
publishToSonatype
closeAndReleaseStagingRepository
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
env:
SIMBOT_IS_SNAPSHOT: true
SIMBOT_SNAPSHOT_ONLY: true
deploy-doc:
name: Deploy-doc
runs-on: ubuntu-latest
needs: run-test-and-publish
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
# setup Java
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
# setup Gradle
- name: Gradle generate documentation
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
dokkaHtmlMultiModule
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
- name: Push to doc repository
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PUSH_TOKEN }}
external_repository: simple-robot-library/simbot3-api-docs
publish_branch: kdoc-deploy/component-qq-guild
publish_dir: ./build/dokka/html
# deploy to sub dir
destination_dir: components/qq-guild