Skip to content

Commit 3c13378

Browse files
committed
修正语法错误和打包问题
1 parent 3536ec6 commit 3c13378

6 files changed

Lines changed: 101 additions & 3235 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ permissions:
1010

1111
jobs:
1212
linux:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
arch: [x86_64, aarch64]
17+
include:
18+
- arch: amd64
19+
target_gnu: x86_64-unknown-linux-gnu
20+
target_musl: x86_64-unknown-linux-musl
21+
use_cross: false
22+
- arch: arm64
23+
target_gnu: aarch64-unknown-linux-gnu
24+
target_musl: aarch64-unknown-linux-musl
25+
use_cross: true
1826
steps:
1927
- name: Checkout
2028
uses: actions/checkout@v4
@@ -41,60 +49,49 @@ jobs:
4149
desktop-file-utils \
4250
zstd \
4351
fakeroot \
44-
libfuse2
52+
libfuse2 \
53+
zip
4554
4655
- name: Install Rust
4756
uses: dtolnay/rust-toolchain@stable
4857
with:
49-
targets: x86_64-unknown-linux-musl,aarch64-unknown-linux-musl,aarch64-unknown-linux-gnu
58+
targets: ${{ matrix.target_gnu }},${{ matrix.target_musl }}
5059

5160
- name: Install packaging tools (Linux x86_64)
52-
if: matrix.arch == 'x86_64'
61+
if: matrix.arch == 'amd64'
5362
run: |
5463
cargo install cargo-deb --locked
5564
cargo install cargo-generate-rpm --locked
5665
57-
- name: Install cross (Linux aarch64)
58-
if: matrix.arch == 'aarch64'
66+
- name: Install cross (Linux arm64)
67+
if: matrix.use_cross
5968
run: cargo install cross --locked
6069

61-
- name: Build release
70+
- name: Build release (CLI, musl, static)
6271
run: |
63-
if [ "${{ matrix.arch }}" = "x86_64" ]; then
64-
cargo build --release --target x86_64-unknown-linux-musl --no-default-features
65-
cargo build --release
72+
if [ "${{ matrix.use_cross }}" = "true" ]; then
73+
cross build --release --no-default-features --target ${{ matrix.target_musl }}
6674
else
67-
cross build --release --target aarch64-unknown-linux-musl --no-default-features
68-
cross build --release --target aarch64-unknown-linux-gnu
75+
cargo build --release --no-default-features --target ${{ matrix.target_musl }}
76+
fi
77+
78+
- name: Build release (GUI, glibc)
79+
run: |
80+
if [ "${{ matrix.use_cross }}" = "true" ]; then
81+
cross build --release --target ${{ matrix.target_gnu }}
82+
else
83+
cargo build --release
6984
fi
7085
7186
- name: Package (Linux)
7287
shell: bash
7388
run: |
7489
mkdir -p dist
7590
76-
if [ "${{ matrix.arch }}" = "x86_64" ]; then
77-
cp target/x86_64-unknown-linux-musl/release/fontsync dist/fontsync-server
78-
cp packaging/fontsync.service dist/
79-
tar -czf dist/fontsync-linux-server-x86_64-musl.tar.gz -C dist fontsync-server fontsync.service
80-
81-
cp target/release/fontsync dist/fontsync-gui
82-
tar -czf dist/fontsync-linux-gui-x86_64.tar.gz -C dist fontsync-gui
83-
84-
# AppImage
85-
curl -L -o linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
86-
chmod +x linuxdeploy-x86_64.AppImage
87-
APPDIR="$PWD/dist/appdir"
88-
mkdir -p "$APPDIR/usr/bin"
89-
cp target/release/fontsync "$APPDIR/usr/bin/fontsync"
90-
./linuxdeploy-x86_64.AppImage \
91-
--appdir "$APPDIR" \
92-
--executable "$APPDIR/usr/bin/fontsync" \
93-
--desktop-file packaging/linux/fontsync.desktop \
94-
--icon-file packaging/linux/fontsync.svg \
95-
--output appimage
96-
mv *.AppImage dist/fontsync-linux-gui-x86_64.AppImage
91+
cp target/${{ matrix.target_musl }}/release/fontsync dist/fontsync-server
92+
zip -j dist/fontsync-linux-server-${{ matrix.arch }}.zip dist/fontsync-server
9793
94+
if [ "${{ matrix.arch }}" = "amd64" ]; then
9895
# deb
9996
cargo deb --no-build
10097
mv target/debian/*.deb dist/
@@ -107,19 +104,15 @@ jobs:
107104
cp target/release/fontsync packaging/arch/src/fontsync
108105
sed -i "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" packaging/arch/PKGBUILD
109106
docker run --rm -v "$PWD:/work" -w /work archlinux:latest bash -lc "\
110-
pacman -Sy --noconfirm base-devel zstd && \
107+
pacman -Sy --noconfirm base-devel zstd dbus pkgconf \
108+
libx11 libxext libxinerama libxcursor libxrender libxfixes libxft \
109+
fontconfig pango cairo glib2 musl patchelf desktop-file-utils \
110+
fakeroot fuse2 && \
111111
useradd -m build && \
112112
chown -R build:build /work && \
113113
su build -c 'cd packaging/arch && makepkg -f --nodeps --noconfirm' \
114114
"
115115
mv packaging/arch/*.pkg.tar.zst dist/
116-
else
117-
cp target/aarch64-unknown-linux-musl/release/fontsync dist/fontsync-server
118-
cp packaging/fontsync.service dist/
119-
tar -czf dist/fontsync-linux-server-aarch64-musl.tar.gz -C dist fontsync-server fontsync.service
120-
121-
cp target/aarch64-unknown-linux-gnu/release/fontsync dist/fontsync-gui
122-
tar -czf dist/fontsync-linux-gui-aarch64.tar.gz -C dist fontsync-gui
123116
fi
124117
125118
- name: Upload Artifacts (Linux)
@@ -150,6 +143,8 @@ jobs:
150143
targets: ${{ matrix.target }}
151144

152145
- name: Build release
146+
env:
147+
RUSTFLAGS: -C target-feature=+crt-static
153148
run: cargo build --release --target ${{ matrix.target }}
154149

155150
- name: Package (Windows)

0 commit comments

Comments
 (0)