-
Notifications
You must be signed in to change notification settings - Fork 14
280 lines (197 loc) · 7.6 KB
/
publish-core.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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
name: publish ndk-pkg core
on:
workflow_dispatch:
jobs:
base:
runs-on: ubuntu-latest
steps:
- id: calculate-release-version
run: |
RELEASE_VERSION="$(date +%Y.%m.%d)"
printf 'RELEASE_VERSION=%s\n' "$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
outputs:
release-version: ${{ steps.calculate-release-version.outputs.RELEASE_VERSION }}
macos:
needs: base
runs-on: macos-14
strategy:
fail-fast: false
matrix:
target-version: ['10.15', '11.0', '12.0', '13.0', '14.0', '15.0']
target-arch: [x86_64, arm64]
steps:
- uses: actions/checkout@v4
- run: install -d out/
- run: mv fonts.conf out/
- run: |
set -ex
CC="$(xcrun --sdk macosx --find clang)"
SYSROOT="$(xcrun --sdk macosx --show-sdk-path)"
CFLAGS="-isysroot $SYSROOT -mmacosx-version-min=${{ matrix.target-version }} -arch ${{ matrix.target-arch }} -Qunused-arguments"
for f in *.c
do
o="out/${f%.c}"
$CC $CFLAGS -std=c99 -Os -flto -o "$o" "$f"
strip "$o"
done
- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: curl -LO https://raw.githubusercontent.com/leleliu008/xcpkg/master/xcpkg
- run: chmod a+x xcpkg
- run: ./xcpkg setup
- run: ./xcpkg update
- run: ./xcpkg install MacOSX-${{ matrix.target-version }}-${{ matrix.target-arch }}/uppm@0.15.4
- run: ./xcpkg pack MacOSX-${{ matrix.target-version }}-${{ matrix.target-arch }}/uppm@0.15.4
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.xcpkg
- run: mv *.otf out/
- run: |
DIRNAME="ndk-pkg-core-${{ needs.base.outputs.release-version }}-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- uses: actions/upload-artifact@v4
with:
name: ndk-pkg-core-macos-${{ matrix.target-version }}-${{ matrix.target-arch }}.tar.xz
path: ndk-pkg-core-*.tar.xz
linux-x86_64:
needs: base
runs-on: ubuntu-latest
container: alpine:3.19
steps:
- run: apk update
- run: apk add curl xz g++ libc-dev linux-headers
- uses: actions/checkout@v4
- run: install -d out/
- run: mv fonts.conf out/
- run: |
for item in *.c
do
gcc -std=c99 -Os -flto -Wl,-s -static -o "out/${item%.c}" "$item"
done
- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: curl -LO https://raw.githubusercontent.com/leleliu008/ppkg/master/ppkg
- run: chmod a+x ppkg
- run: ./ppkg setup
- run: ./ppkg update
- run: ./ppkg install uppm@0.15.4 --static
- run: ./ppkg pack uppm@0.15.4
- run: tar vxf uppm*.tar.xz -C out --strip-components=1
- run: mv out/bin/uppm out/
- run: rm -rf out/bin
- run: rm -rf out/share
- run: rm -rf out/.ppkg
- run: mv *.otf out/
- run: |
DIRNAME="ndk-pkg-core-${{ needs.base.outputs.release-version }}-linux-x86_64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- uses: actions/upload-artifact@v4
with:
name: ndk-pkg-core-linux-x86_64.tar.xz
path: ndk-pkg-core-*.tar.xz
linux-aarch64:
needs: base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- run: curl -LO https://raw.githubusercontent.com/leleliu008/ppkg/master/ppkg
- run: chmod a+x ppkg
- run: install -d out/
- run: mv fonts.conf out/
- run: mv *.otf out/
- run: |
cat > run.sh <<EOF
set -ex
apk update
apk add curl xz g++ libc-dev linux-headers
for f in *.c
do
gcc -std=c99 -Os -flto -Wl,-s -static -o "out/\${f%.c}" "\$f"
done
./ppkg setup
./ppkg update
./ppkg install uppm@0.15.4 --static
./ppkg pack uppm@0.15.4
tar vxf uppm*.tar.xz -C out --strip-components=1
mv out/bin/uppm out/
rm -rf out/bin
rm -rf out/share
rm -rf out/.ppkg
EOF
# https://github.com/multiarch/qemu-user-static
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- run: docker run -v $PWD:/root -w /root --name alpine arm64v8/alpine:3.16 sh run.sh
- run: |
DIRNAME="ndk-pkg-core-${{ needs.base.outputs.release-version }}-linux-aarch64"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- uses: actions/upload-artifact@v4
with:
name: ndk-pkg-core-linux-aarch64.tar.xz
path: ndk-pkg-core-*.tar.xz
android:
needs: base
runs-on: ubuntu-latest
container: ubuntu:24.04
strategy:
fail-fast: false
matrix:
target-version: [35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21]
steps:
- run: apt -y update
- run: apt -y install curl tar gzip xz-utils
- run: curl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg
- run: chmod +x ndk-pkg
- run: ./ndk-pkg setup
- run: ./ndk-pkg update
- run: ./ndk-pkg install android-${{ matrix.target-version }}-arm64-v8a/uppm@0.15.4
- run: ./ndk-pkg install android-${{ matrix.target-version }}-arm64-v8a/ndk-pkg-core
- run: ./ndk-pkg pack android-${{ matrix.target-version }}-arm64-v8a/uppm@0.15.4 -o .
- run: ./ndk-pkg pack android-${{ matrix.target-version }}-arm64-v8a/ndk-pkg-core -o .
- run: curl -LO https://raw.githubusercontent.com/adobe-fonts/source-code-pro/release/OTF/SourceCodePro-Light.otf
- name: repack
run: |
set -ex
install -d out
for item in *.tar.xz
do
tar vxf "$item" -C out --strip-components=1
rm -v "$item"
done
mv out/bin/* out/
mv *.otf out/
rm -rf out/bin
rm -rf out/share
DIRNAME="ndk-pkg-core-${{ needs.base.outputs.release-version }}-android-${{ matrix.target-version }}-arm64-v8a"
mv out "$DIRNAME"
tar cJvf "$DIRNAME.tar.xz" "$DIRNAME"
- uses: actions/upload-artifact@v4
with:
name: ndk-pkg-core-android-${{ matrix.target-version }}-arm64-v8a.tar.xz
path: ndk-pkg-core-*.tar.xz
publish:
needs: [base, macos, linux-x86_64, linux-aarch64, android]
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/download-artifact@v4
with:
pattern: '*'
path: .
merge-multiple: true
- run: ls -a
# to avaid: failed to run git: fatal: not a git repository (or any of the parent directories): .git
- run: git -c init.defaultBranch=master init
- run: git remote add origin ${{ github.repositoryUrl }}
- run: |
cat > notes.md <<EOF
sha256sum:
\`\`\`
$(sha256sum ndk-pkg-core-*.tar.xz)
\`\`\`
EOF
- run: gh release create ndk-pkg-core-${{ needs.base.outputs.release-version }} ndk-pkg-core-*.tar.xz --title ndk-pkg-core-${{ needs.base.outputs.release-version }} --notes-file notes.md