-
Notifications
You must be signed in to change notification settings - Fork 2.5k
168 lines (138 loc) · 5.37 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
name: Release Publish
on:
push:
tags:
- 'v*' # 正式版本
paths-ignore:
- 'docs/**'
- 'mirai-console/docs/**'
- '**/*.md'
jobs:
initialize-sonatype-stage:
name: "Initialize sonatype staging repository"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- run: chmod -R 777 *
- name: Create publishing staging repository
run: ./gradlew runcihelper --args create-stage-repo --scan "-Pcihelper.cert.username=${{ secrets.SONATYPE_USER }}" "-Pcihelper.cert.password=${{ secrets.SONATYPE_KEY }}" "-Pcihelper.cert.profileid=${{ secrets.SONATYPE_PROFILEID }}"
- name: Cache staging repository id
uses: actions/upload-artifact@v3
with:
name: publish-stage-id
path: ci-release-helper/repoid
publish-others:
name: "Others (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
needs: [ initialize-sonatype-stage ]
strategy:
fail-fast: false
matrix:
os:
- macos-12
env:
# All targets MUST be enabled. See #2270.
gradleArgs: --scan "-Dmirai.target=other" "-Pkotlin.compiler.execution.strategy=in-process"
isMac: ${{ startsWith(matrix.os, 'macos') }}
isWindows: ${{ startsWith(matrix.os, 'windows') }}
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
isUnix: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Keys setup
shell: bash
run: |
mkdir build-gpg-sign
echo "$GPG_PRIVATE" > build-gpg-sign/keys.gpg
echo "$GPG_PUBLIC_" > build-gpg-sign/keys.gpg.pub
env:
GPG_PRIVATE: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PUBLIC_: ${{ secrets.GPG_PUBLIC_KEY }}
- name: Setup Android SDK Ubuntu
if: ${{ env.isUbuntu == 'true' }}
run: 'touch local.properties && echo sdk.dir=/usr/local/lib/android/sdk >> local.properties'
- name: Setup Android SDK macOS
if: ${{ env.isMac == 'true' }}
run: 'touch local.properties && echo sdk.dir=/Users/runner/Library/Android/sdk >> local.properties'
- name: Setup Android SDK Windows
if: ${{ env.isWindows == 'true' }}
run: 'echo sdk.dir=C:\Android\android-sdk >> local.properties'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Cache konan
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- if: ${{ env.isUnix == 'true' }}
run: chmod -R 777 *
# Prepare environment for linking for macOS
- name: Clean and download dependencies
run: ./gradlew clean ${{ env.gradleArgs }}
- name: "Assemble"
run: ./gradlew assemble ${{ env.gradleArgs }}
- name: Publish Local Artifacts
if: ${{ env.enableLocalPublishingTest == 'true' }}
run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Dmirai.build.project.version=2.99.0-deps-test"
- name: "Check"
run: ./gradlew check ${{ env.gradleArgs }}
- if: ${{ env.isMac == 'true' }}
name: Ensure KDoc valid
run: ./gradlew dokkaHtmlMultiModule ${{ env.gradleArgs }}
- name: Initialize Publishing Caching Repository
run: ./gradlew runcihelper --args sync-maven-metadata ${{ env.gradleArgs }}
- name: Publish
if: ${{ env.isMac == 'true' }}
run: ./gradlew publishAllPublicationsToMiraiStageRepoRepository ${{ env.gradleArgs }}
- name: Restore staging repository id
uses: actions/download-artifact@v3
with:
name: publish-stage-id
path: ci-release-helper/repoid
- name: Release RAM
run: node ci-release-helper/scripts/kill-java.js
- name: Publish to maven central
run: ./gradlew runcihelper --args publish-to-maven-central --scan "-Pcihelper.cert.username=${{ secrets.SONATYPE_USER }}" "-Pcihelper.cert.password=${{ secrets.SONATYPE_KEY }}"
- name: Publish Gradle plugin
run: ./gradlew
:mirai-console-gradle:publishPlugins ${{ env.gradleArgs }}
-Dgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}
-Dgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}
continue-on-error: true
#
# close-repository:
# runs-on: macos-12
# needs:
# - publish-others
# - publish-core-native
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: 'recursive'
#
# - uses: actions/setup-java@v3
# with:
# distribution: 'adopt-openj9'
# java-version: '17'
#
# - name: Setup Gradle
# uses: gradle/gradle-build-action@v2
#
# - name: Close repository
# run: ./gradlew :ci-release-helper:closeRepository --scan