-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (104 loc) · 3.14 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
name: build and publish release
on:
push:
tags:
- v**
# 手动触发工作流
workflow_dispatch:
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_PRI_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
OSSRH_USER: ${{ secrets.OSS_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSS_PASSWORD }}
RELEASE: true
CI: true
IS_CI: true
SIMBOT_LOCAL: false
GRADLE_OPTS: "-Dfile.encoding=UTF-8"
jobs:
test-build-publish:
name: Test and build
# runs-on: ubuntu-latest
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v3
# Setup java
# https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Test and publish to sonatype
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
arguments: |
assemble
build
allTests
publishToSonatype
closeAndReleaseStagingRepository
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
env:
PLUGIN_AUTO: ${{ matrix.os == 'ubuntu-latest' }}
publish-gradle-plugin:
name: Publish Gradle Plugin
runs-on: ubuntu-latest
needs: test-build-publish
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v3
# Setup java
# https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Publish to gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
arguments: |
build
publishPlugins
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
-Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}
-Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}
env:
PLUGIN_AUTO: true
create-release:
name: Create release
runs-on: ubuntu-latest
needs: [test-build-publish, publish-gradle-plugin]
permissions:
contents: write
steps:
# https://github.com/softprops/action-gh-release
# Create gitHub release
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.FORTE_TOKEN }}
draft: true
# body_path: .changelog/${{ github.ref_name }}.md
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}