-
Notifications
You must be signed in to change notification settings - Fork 342
102 lines (82 loc) · 3.13 KB
/
publish.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
name: Publish Mah
on:
push:
tags: [ 'v*' ]
jobs:
build:
name: Publish to Maven Central
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant Execute Permission for gradlew
run: chmod +x gradlew
- run: ./gradlew mirai-api-http:checkMavenCentralPublication --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- run: ./gradlew mirai-api-http-spi:checkMavenCentralPublication --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- name: Build with Gradle
run: ./gradlew buildCiJar
- name: Build SPI
run: ./gradlew buildSpi
- name: Publish to Maven Central
run: ./gradlew mirai-api-http:publish --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- name: Publish SPI to Maven Central
run: ./gradlew mirai-api-http-spi:publish --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}
- name: Get Tag
id: tag
run: |
tag=$(echo ${{ github.ref }} | cut -dv -f2)
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Generate Line Temp File
run: "cat CHANGELOG.md | grep -n '## \\\\' | cut -d: -f1 | head -n 2 >> line.tmp"
- name: Generate Release Log
run: "cat CHANGELOG.md | head -n $((`tail -n 1 line.tmp`-1)) | tail -n +`head -n 1 line.tmp` >> release.log"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: mirai-api-http-${{ steps.tag.outputs.tag }}
body_path: release.log
draft: false
prerelease: false
files: |
./mirai-api-http/build/ci/mirai-api-http-${{ steps.tag.outputs.tag }}.mirai2.jar
- name: Clone Mirai-Repo
uses: actions/checkout@v3
with:
repository: project-mirai/mirai-repo-mirror
ref: master
token: ${{ secrets.MAMOEBOT_TOKEN }}
path: ./mirai-repo-mirror
- name: Modify package.json
uses: ./.github/actions/modify-package-json
with:
defaultChannel: stable-v2
version: ${{ steps.tag.outputs.tag }}
srcPath: mirai-repo-mirror/net/mamoe/mirai-api-http/package.json
destPath: .github/package.json
- name: Move package.json
run: |
cp .github/package.json mirai-repo-mirror/net/mamoe/mirai-api-http/package.json
- name: Create PR for Mirai-Repo
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.MAMOEBOT_TOKEN }}
commit-message: 'update: mirai-api-http ${{ steps.tag.outputs.tag }}'
title: 'update: mirai-api-http ${{ steps.tag.outputs.tag }}'
branch: create-pull-request/mah-update-version
delete-branch: true
path: ./mirai-repo-mirror
base: master