diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index caca01b..b876405 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,16 +1,34 @@ +name: Publish release on: push: tags: - '*' jobs: - publish: - name: Publish for ${{ matrix.os }} - runs-on: ${{ matrix.os }} + build: + name: Publish + runs-on: ${{ matrix.config.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - + config: + - { + os: ubuntu-latest, + artifact_name: t, + asset_name: t-linux-amd64, + strip: true + } + - { + os: windows-latest, + artifact_name: t.exe, + asset_name: t-windows-amd64, + strip: false + } + - { + os: macos-latest, + artifact_name: t, + asset_name: t-macos-amd64, + strip: true + } steps: - uses: hecrj/setup-rust-action@v1 with: @@ -18,10 +36,21 @@ jobs: - uses: actions/checkout@v2 - name: Build run: cargo build --release + - name: Compress binaries + uses: svenstaro/upx-action@v1-release + with: + file: target/release/${{ matrix.config.artifact_name }} + args: '-9' + strip: ${{ matrix.config.strip }} + - name: Install macOS dependencies + if: matrix.config.os == 'macos-latest' + run: brew install p7zip + - name: Zip binary file + run: 7z a ./${{ matrix.config.asset_name }}.zip ./target/release/${{ matrix.config.artifact_name }} - name: Upload binaries to release uses: svenstaro/upload-release-action@v1-release with: repo_token: ${{ secrets.TOKEN }} - file: target/release/t - asset_name: t-${{ runner.os }} + file: ./${{ matrix.config.asset_name }}.zip + asset_name: ${{ matrix.config.asset_name }}.zip tag: ${{ github.ref }} \ No newline at end of file