Skip to content

Commit

Permalink
Merge pull request #28 from 01010101lzy/compress
Browse files Browse the repository at this point in the history
chore: strip and compress binary when publish
  • Loading branch information
rami3l committed Oct 17, 2020
2 parents 0952a58 + e8b6cf1 commit e068d31
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: publish
on:
push:
tags:
- "*"
- '*'

jobs:
publish-non-linux:
Expand All @@ -26,9 +26,29 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v1

- name: Install UPX on Windows
if: ${{matrix.os == 'windows-latest'}}
run: choco install upx

- name: Install UPX on MacOS
if: ${{matrix.os == 'macos-latest'}}
run: brew install upx

- name: Build
run: cargo build --release --locked

- name: compress (windows)
if: ${{matrix.os == 'windows-latest'}}
run: |
strip -s ./target/release/${{ matrix.artifact_name }}
upx -9 --lzma ./target/release/${{ matrix.artifact_name }}
- name: compress (macos)
if: ${{matrix.os == 'macos-latest'}}
run: |
strip ./target/release/${{ matrix.artifact_name }}
upx -9 --lzma ./target/release/${{ matrix.artifact_name }}
- name: Zip
run: tar czvf ${{ matrix.asset_name }}.tar.gz -C ./target/release/ ${{ matrix.artifact_name }}

Expand Down Expand Up @@ -68,11 +88,18 @@ jobs:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable

- run: sudo apt install upx-ucl binutils

- run: rustup target add ${{ matrix.target_name }}

- name: Build
run: cargo build --release --locked --target=${{ matrix.target_name }}

- name: compress
run: |
strip -s ./target/${{ matrix.target_name }}/release/${{ matrix.artifact_name }}
upx -9 --lzma ./target/${{ matrix.target_name }}/release/${{ matrix.artifact_name }}
- name: Zip
run: tar czvf ${{ matrix.asset_name }}.tar.gz -C ./target/${{ matrix.target_name }}/release/ ${{ matrix.artifact_name }}

Expand Down Expand Up @@ -148,8 +175,8 @@ jobs:
uses: rami3l/bumper@master
id: replace
with:
template: "dist/brew/template.rb"
out: "pacaptr.rb"
template: 'dist/brew/template.rb'
out: 'pacaptr.rb'

rules: |
{
Expand All @@ -167,8 +194,8 @@ jobs:
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "pacaptr.rb"
asset_name: "pacaptr.rb"
file: 'pacaptr.rb'
asset_name: 'pacaptr.rb'
tag: ${{ github.ref }}
overwrite: true

Expand Down

0 comments on commit e068d31

Please sign in to comment.