Update README.md and Example. #23
Workflow file for this run
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: Build Release | |
on: | |
push: | |
paths: | |
- 'clashtui/**' | |
- '.github/**' | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Mihomo | |
run: | | |
curl -L https://github.com/MetaCubeX/mihomo/releases/download/v1.18.1/mihomo-windows-amd64-v1.18.1.zip --output mihomo.zip | |
7z x mihomo.zip | |
mihomo-windows-amd64.exe -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 --release --all | |
- name: Build | |
run: cd clashtui && cargo build --release | |
- name: Build Version | |
run: | | |
cd clashtui | |
cargo run --release -- -v >> version.txt | |
- name: Pre Upload | |
run: | | |
mkdir artifacts | |
mv ./clashtui/target/release/clashtui.exe ./artifacts/clashtui.exe | |
mv ./clashtui/version.txt ./artifacts/version.txt | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Windows_Build | |
path: artifacts | |
retention-days: 5 | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-windows] | |
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: | | |
cd ./artifacts | |
zip clashtui-windows-amd64-v${{ env.CLASHTUI_VERSION }}.zip -- clashtui.exe | |
- name: Upload Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
artifacts/clashtui-windows-amd64-v${{ env.CLASHTUI_VERSION }}.zip |