Skip to content

Commit

Permalink
fix artifacts build
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackhr-arch committed Aug 30, 2024
1 parent 0c77be9 commit 7ee187b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
fetch-depth: 0

- name: Cache Target
- name: Cache
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@v4
with:
Expand All @@ -32,11 +32,14 @@ jobs:
ci-${{ runner.os }}-${{ hashFiles('./Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
- name: Test
run: |
cargo install --debug cargo-make
cargo make ci
- name: Build
run: cargo make upx

- name: upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -45,8 +48,8 @@ jobs:
retention-days: 5

release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

needs: build

Expand All @@ -60,14 +63,6 @@ jobs:
merge-multiple: true
path: ./artifacts

- name: UPX compress
run: |
chmod +x ./artifacts/*
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
tar -xf upx-4.2.4-amd64_linux.tar.xz
cp ./upx-4.2.4-amd64_linux/upx .
./upx ./artifacts/*
- name: Create Release
uses: softprops/action-gh-release@v2
with:
Expand Down
27 changes: 27 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ script = '''
'''

[tasks.clear-artifacts]
private = true
script_runner = "@shell"
ignore_errors = true
script = ["rm -r artifacts"]

[tasks.build_deb]
Expand All @@ -63,3 +65,28 @@ script = '''
cargo build --bin clashtui --all-features
cargo build --bin clashtui --all-features --release
'''


[tasks.upx.linux]
dependencies = ["release"]
script = '''
chmod +x artifacts/*
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz
tar -xf upx-4.2.4-amd64_linux.tar.xz
rm upx-4.2.4-amd64_linux.tar.xz
cp ./upx-4.2.4-amd64_linux/upx .
rm -r ./upx-4.2.4-amd64_linux
./upx artifacts/*.release artifacts/*.debug
rm upx
'''

[tasks.upx.windows]
dependencies = ["release"]
script = '''
curl -OL https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip
tar -xf upx-4.2.4-win64.zip
cp ./upx-4.2.4-win64/upx.exe .
rm -r ./upx-4.2.4-win64
./upx.exe artifacts/*.exe
rm upx.exe
'''

0 comments on commit 7ee187b

Please sign in to comment.