Skip to content

fixup! feat: Download file with token #124

fixup! feat: Download file with token

fixup! feat: Download file with token #124

Workflow file for this run

name: Build Release
on:
push:
paths:
- 'clashtui/**'
- '.github/workflows/build_release.yml'
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2
- name: Set up Mihomo
run: |
wget --output-document mihomo.gz https://github.com/MetaCubeX/mihomo/releases/download/v1.18.0/mihomo-linux-amd64-v1.18.0.gz
gunzip mihomo.gz
chmod +x mihomo
nohup ./mihomo -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashtui && cargo fetch
- name: Run tests
run: cd clashtui && cargo test --all
- name: Build
run: |
cd clashtui
cargo build --locked
cargo build --release --locked
- name: Build linux arm64
run: |
rustup target add aarch64-unknown-linux-gnu
cd clashtui
cargo install cargo-zigbuild
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --locked
cargo zigbuild --target aarch64-unknown-linux-gnu.2.17 --release --locked
- name: Build Version
run: |
cd clashtui && cargo run --release -- -v >> version.txt
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/debug/clashtui ./artifacts/clashtui-amd64-debug
mv ./clashtui/target/release/clashtui ./artifacts/clashtui-amd64
mv ./clashtui/target/aarch64-unknown-linux-gnu/debug/clashtui ./artifacts/clashtui-arm64-debug
mv ./clashtui/target/aarch64-unknown-linux-gnu/release/clashtui ./artifacts/clashtui-arm64
mv ./clashtui/version.txt ./artifacts/version.txt
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: Linux_Build
path: artifacts
retention-days: 5
release:
runs-on: ubuntu-latest
needs: [build-linux]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts
- name: Get version
run: |
cd ./artifacts
echo CLASHTUI_VERSION="$(cat version.txt)" >> $GITHUB_ENV
- name: Archive Release
run: |
gzip -c ./artifacts/clashtui-amd64 > clashtui-linux-amd64-${{ env.CLASHTUI_VERSION }}.gz
gzip -c ./artifacts/clashtui-arm64 > clashtui-linux-arm64-${{ env.CLASHTUI_VERSION }}.gz
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
prerelease: true
files: |
clashtui-linux-amd64-${{ env.CLASHTUI_VERSION }}.gz
clashtui-linux-arm64-${{ env.CLASHTUI_VERSION }}.gz