Skip to content

Commit 7801e6e

Browse files
committed
ci: update build action
Signed-off-by: sbwml <admin@cooluc.com>
1 parent 2e7ec92 commit 7801e6e

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/build-release.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ jobs:
2929
run: |
3030
bash <(curl --proto '=https' --tlsv1.2 -sS ${{ secrets.rustup }}) ${{ matrix.target }}
3131
32-
- name: Install cross
33-
run: cargo install cross
34-
3532
- name: Install upx
3633
run: |
3734
wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
@@ -47,16 +44,28 @@ jobs:
4744
shadowsocks_version="$(git describe --tags `git rev-list --tags --max-count=1`)"
4845
echo shadowsocks_version="$shadowsocks_version" >> "$GITHUB_ENV"
4946
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
50-
cd build
51-
./build-release -t ${{ matrix.target }} -f full -u
52-
cd release
47+
# moka
48+
if [ "$shadowsocks_version" = "v1.22.0" ]; then
49+
echo '[patch.crates-io]' >> Cargo.toml
50+
echo 'moka = { git = "https://github.com/moka-rs/moka.git", branch = "main" }' >> Cargo.toml
51+
fi
52+
cd ..
53+
[ "${{ matrix.target }}" = "mips-unknown-linux-musl" ] && target=mips || target=mipsel
54+
export $(echo "CARGO_TARGET_$(echo "$target" | tr '[:lower:]' '[:upper:]')_UNKNOWN_LINUX_MUSL_LINKER"="$target-openwrt-linux-musl-gcc")
55+
CARGO_BUILD_TARGET=${{ matrix.target }} \
56+
CARGO_HOME=install \
57+
RUSTFLAGS="-Ctarget-feature=-crt-static -lssp_nonshared -Clink-arg=-fuse-ld=bfd" \
58+
TARGET_CC=$target-openwrt-linux-musl-gcc \
59+
cargo install --profile release --features "full" --path "shadowsocks-rust"
60+
upx -9 install/bin/*
61+
tar -Jcf shadowsocks-$shadowsocks_version.${{ matrix.target }}.tar.xz -C install/bin .
5362
sha256sum shadowsocks-$shadowsocks_version.${{ matrix.target }}.tar.xz > shadowsocks-$shadowsocks_version.${{ matrix.target }}.tar.xz.sha256
5463
5564
- name: Upload artifacts
5665
uses: actions/upload-artifact@v4
5766
with:
5867
name: shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}
59-
path: shadowsocks-rust/build/release/shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz
68+
path: shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz
6069

6170
- name: Create release
6271
continue-on-error: true
@@ -68,4 +77,6 @@ jobs:
6877
commit: main
6978
tag: ${{ env.shadowsocks_version }}
7079
token: ${{ secrets.GITHUB_TOKEN }}
71-
artifacts: shadowsocks-rust/build/release/shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz,shadowsocks-rust/build/release/shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz.sha256
80+
artifacts: |
81+
shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz
82+
shadowsocks-${{ env.shadowsocks_version }}.${{ matrix.target }}.tar.xz.sha256

0 commit comments

Comments
 (0)