-
-
Notifications
You must be signed in to change notification settings - Fork 43
148 lines (133 loc) · 4.12 KB
/
publish-v4-snapshot.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
name: Publish v4 Snapshot
on: # push
workflow_dispatch:
push:
branches:
- v4-dev
- v4-dev-snapshot**
- v4.*.**
paths:
- 'buildSrc'
- '**src/**/kotlin/**.kt'
- '**src/**/java/**.java'
- '**/src/**/kotlin/**.kt'
- '**/src/**/java/**.java'
- '**/build.gradle.kts'
- 'build.gradle.kts'
- 'settings.gradle.kts'
- 'gradle.properties'
env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
NODE_VERSION: 22
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIMBOT_IS_SNAPSHOT: true
SIMBOT_SNAPSHOT_ONLY: true
GRADLE_OPTS: "-XX:MaxMetaspaceSize=2g -Dfile.encoding=UTF-8"
jobs:
run-tests:
name: Run all tests
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
- run: gradle assemble allTests -s
- name: Upload test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports-${{ matrix.os }}
path: '**/build/reports/tests'
retention-days: 7
publish-v4-snapshot:
name: Publish v4 snapshot
needs: run-tests
runs-on: ubuntu-latest
steps:
# 检出仓库代码
- uses: actions/checkout@v4
# setup Java
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Publish snapshots
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: |
publishToSonatype
closeAndReleaseStagingRepositories
--info
--warning-mode all
-x test
-Porg.gradle.jvmargs="-Xms4G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8"
env:
SIMBOT_IS_SNAPSHOT: true
# parallel=true 容易出现 Metaspace 的异常? 去了试试
deploy-doc:
name: Deploy snapshots API doc
needs: publish-v4-snapshot
runs-on: macos-latest # ubuntu-latest
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: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
# setup Gradle
- name: Gradle generate documentation
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: |
dokkaHtmlMultiModule
-s
--warning-mode all
-x test
-Porg.gradle.jvmargs="-Xms4G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8"
# -Porg.gradle.parallel=false
# -Porg.gradle.daemon=false
env:
SIMBOT_IS_SNAPSHOT: true
# https://github.com/marketplace/actions/github-pages-action
- 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/snapshots/main-v4
publish_dir: ./build/dokka/html
destination_dir: snapshots/main-v4