-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (182 loc) · 5.81 KB
/
publish.yml
File metadata and controls
201 lines (182 loc) · 5.81 KB
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Publish
on:
- workflow_dispatch
env:
RELEASER_CHANGER: gradle-properties
defaults:
run:
shell: bash
jobs:
version-up:
environment: deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: "${{ secrets.ACTIONS_PAT }}"
- uses: anatawa12/something-releaser@v2
- run: set-git-user anatawa12-bot
- name: Update Version
run: |
git switch -c releasing
# set current version
VERSION="$(get-version)"
if ! [[ "$VERSION" = *-SNAPSHOT ]]; then
echo 'VERSION IS NOT SNAPSHOT' >&2
exit 1
fi
VERSION="$(version-unsnapshot "$VERSION")"
set-version "$VERSION"
# create changelog
generate-changelog -v "$VERSION" --date-for-unreleased
# update versions in documentation
function replace_version() {
perl -pi \
-e 's/(?<=\Q("com.anatawa12.mod-patching.'"$1"'") version \E)".*"/"'$VERSION'"/' \
README.md
}
replace_version common
replace_version binary
replace_version source
replace_version resources-dev
# commit & tag & push
git add .
git commit -m "v$VERSION"
git tag "v$VERSION"
git push -u origin releasing
git push -u origin "v$VERSION"
build-rust:
needs: [ version-up ]
environment: deployment
strategy:
matrix:
include:
# macOS: no cross on macOS
- target: x86_64-apple-darwin
os: macos-latest
test: true
cross: false
- target: aarch64-apple-darwin
os: macos-latest
test: true
cross: false
# windows: with cross on ubuntu
- target: aarch64-pc-windows-msvc
os: windows-latest
test: false
cross: false
- target: i686-pc-windows-msvc
os: windows-latest
test: true
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
test: true
cross: false
# linux: with cross on ubuntu
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
test: true
cross: true
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
test: true
cross: true
- target: i686-unknown-linux-musl
os: ubuntu-latest
test: true
cross: true
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
test: true
cross: true
runs-on: ${{ matrix.os }}
env:
ENABLE_CLI_TOOL: true
steps:
- uses: actions/checkout@v3
with:
submodules: true
ref: releasing
- uses: anatawa12/something-releaser@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
- name: Install Cross
run: cargo install cross && cross --version
if: ${{ fromJson(matrix.cross) }}
- name: Build
env:
RUSTFLAGS: -C target-feature=+crt-static
run: ./gradlew cli-tool:buildCargoNative -Pcli-tool-target=${{ matrix.target }} -Pcli-tool-cross=${{ matrix.cross }}
- uses: actions/upload-artifact@v3
with:
name: cli-${{ matrix.target }}
path: cli-tool/build/cargo/${{ matrix.target }}/release/mod-patching*
publish:
needs: [ version-up, build-rust ]
environment: deployment
runs-on: ubuntu-latest
env:
ENABLE_CLI_TOOL: false
steps:
- uses: actions/checkout@v3
with:
ref: releasing
- uses: anatawa12/something-releaser@v2
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
# download built binaries
- uses: actions/download-artifact@v2
with:
path: cli-tool-publisher/download
- name: Prepare Build
run: |
prepare-gradle-signing "$GPG_PRIVATE_KEY" "$GPG_PRIVATE_PASS"
prepare-gradle-maven "https://oss.sonatype.org/service/local/staging/deploy/maven2/" \
--user "$SONATYPE_USER" \
--pass "$SONATYPE_PASS"
prepare-gradle-plugin-portal "$GRADLE_KEY" "$GRADLE_SECRET"
env:
GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
GPG_PRIVATE_PASS: "${{ secrets.GPG_PRIVATE_PASS }}"
SONATYPE_USER: "${{ secrets.SONATYPE_USER }}"
SONATYPE_PASS: "${{ secrets.SONATYPE_PASS }}"
GRADLE_KEY: "${{ secrets.GRADLE_KEY }}"
GRADLE_SECRET: "${{ secrets.GRADLE_SECRET }}"
- run: ./gradlew publish publishPlugins
next-version:
needs: [ publish ]
environment: deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
token: "${{ secrets.ACTIONS_PAT }}"
ref: releasing
fetch-depth: 2
- uses: anatawa12/something-releaser@v2
- run: set-git-user anatawa12-bot
- name: Update To Next Version
run: |
VERSION="$(get-version)"
VERSION="$(version-next "$VERSION")"
set-version "$(version-snapshot "$VERSION")"
git add .
git commit -m "prepare for next version: $VERSION"
git push
# clone master
git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git fetch --depth 1 origin master
git switch master
git reset --hard releasing
git push -u origin master
git push --delete origin releasing