Skip to content

Commit

Permalink
Merge pull request #538 from Nukesor/update-release-action
Browse files Browse the repository at this point in the history
fix: Releases pipeline
  • Loading branch information
Nukesor authored Jun 4, 2024
2 parents 990f1aa + 386e4dd commit 8f3d592
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 65 deletions.
94 changes: 29 additions & 65 deletions .github/workflows/package-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,81 +12,41 @@ jobs:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- arm-unknown-linux-musleabihf
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
client_artifact_name: target/x86_64-unknown-linux-musl/release/pueue
daemon_artifact_name: target/x86_64-unknown-linux-musl/release/pueued
client_release_name: pueue-linux-x86_64
daemon_release_name: pueued-linux-x86_64
cross: true
strip: true
compress: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
client_artifact_name: target/aarch64-unknown-linux-musl/release/pueue
daemon_artifact_name: target/aarch64-unknown-linux-musl/release/pueued
client_release_name: pueue-linux-aarch64
daemon_release_name: pueued-linux-aarch64
cross: true
strip: false
compress: true
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
client_artifact_name: target/armv7-unknown-linux-musleabihf/release/pueue
daemon_artifact_name: target/armv7-unknown-linux-musleabihf/release/pueued
client_release_name: pueue-linux-armv7
daemon_release_name: pueued-linux-armv7
cross: true
strip: false
compress: true
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
client_artifact_name: target/arm-unknown-linux-musleabihf/release/pueue
daemon_artifact_name: target/arm-unknown-linux-musleabihf/release/pueued
client_release_name: pueue-linux-arm
daemon_release_name: pueued-linux-arm
cross: true
strip: false
compress: true
- os: ubuntu-latest
target: x86_64-unknown-freebsd
compress: false
- os: windows-latest
target: x86_64-pc-windows-msvc
client_artifact_name: target/x86_64-pc-windows-msvc/release/pueue.exe
daemon_artifact_name: target/x86_64-pc-windows-msvc/release/pueued.exe
client_release_name: pueue-windows-x86_64.exe
daemon_release_name: pueued-windows-x86_64.exe
cross: false
strip: true
compress: false
- os: macos-latest
target: x86_64-apple-darwin
client_artifact_name: target/x86_64-apple-darwin/release/pueue
daemon_artifact_name: target/x86_64-apple-darwin/release/pueued
client_release_name: pueue-macos-x86_64
daemon_release_name: pueued-macos-x86_64
cross: false
strip: true
compress: false
- os: macos-latest
target: aarch64-apple-darwin
client_artifact_name: target/aarch64-apple-darwin/release/pueue
daemon_artifact_name: target/aarch64-apple-darwin/release/pueued
client_release_name: pueue-darwin-aarch64
daemon_release_name: pueued-darwin-aarch64
cross: false
strip: true
compress: false

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
targets: ${{ matrix.target }}

- run: sudo apt install musl-tools
if: startsWith(matrix.os, 'ubuntu')

- name: cargo build
uses: houseabsolute/actions-rust-cross@v0
Expand All @@ -95,37 +55,41 @@ jobs:
args: --release --locked
target: ${{ matrix.target }}

- name: Set exe extension for Windows
run: echo "EXE=.exe" >> $env:GITHUB_ENV
if: startsWith(matrix.os, 'windows')

- name: Compress client
uses: svenstaro/upx-action@v2
with:
file: ${{ matrix.client_artifact_name }}
args: --lzma
strip: ${{ matrix.strip }}
if: matrix.target != 'x86_64-pc-windows-msvc'
file: target/${{ matrix.target }}/release/pueue${{ env.EXE }}
args: --best --lzma
strip: false
if: ${{ matrix.compress }}

- name: Compress daemon
uses: svenstaro/upx-action@v2
with:
file: ${{ matrix.daemon_artifact_name }}
args: --lzma
strip: ${{ matrix.strip }}
if: matrix.target != 'x86_64-pc-windows-msvc'
file: target/${{ matrix.target }}/release/pueued${{ env.EXE }}
args: --best --lzma
strip: false
if: ${{ matrix.compress }}

- name: Upload client binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.client_artifact_name }}
asset_name: ${{ matrix.client_release_name }}
file: target/${{ matrix.target }}/release/pueue${{ env.EXE }}
asset_name: pueue-${{ matrix.target }}${{ env.EXE }}
tag: ${{ github.ref }}
overwrite: true

- name: Upload daemon binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.daemon_artifact_name }}
asset_name: ${{ matrix.daemon_release_name }}
file: target/${{ matrix.target }}/release/pueued${{ env.EXE }}
asset_name: pueued-${{ matrix.target }}${{ env.EXE }}
tag: ${{ github.ref }}
overwrite: true

Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ better-panic = "0.3"
pretty_assertions = "1"

[profile.release]
codegen-units = 1
lto = "thin"
strip = true

0 comments on commit 8f3d592

Please sign in to comment.