publish ndk-pkg core #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |