Skip to content

Commit

Permalink
add deb package step
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerwooo committed Nov 28, 2023
1 parent 8b15872 commit d57afe3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
steps:
- uses: actions/checkout@master

- name: Get version from Cargo.toml
id: get_version
run: echo "::set-output name=version::$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)"

- name: Set up Ubuntu multiarch
if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64'
run: |
Expand Down Expand Up @@ -110,10 +114,25 @@ jobs:
chmod ugo+x "${{ env.ARCHIVE_NAME }}/${{ env.BIN_NAME }}"
tar -vczf "${{ env.ARCHIVE_NAME }}.tar.gz" "${{ env.ARCHIVE_NAME }}"/*
- name: Build and package deb
if: contains(env.CARGO_BUILD_TARGET, 'unknown-linux')
run: |
cargo install cargo-deb
cargo deb --no-build --target ${{ env.CARGO_BUILD_TARGET }}
- name: Upload binary for release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ARCHIVE_NAME }}${{ endsWith(env.CARGO_BUILD_TARGET, '-windows-msvc') && '.zip' || '.tar.gz'}}
asset_name: ${{env.ARCHIVE_NAME}}-${{ github.ref_name }}${{ endsWith(env.CARGO_BUILD_TARGET, '-windows-msvc') && '.zip' || '.tar.gz'}}
tag: ${{ github.ref }}

- name: Upload deb for release
if: contains(env.CARGO_BUILD_TARGET, 'unknown-linux')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ env.CARGO_BUILD_TARGET }}/debian/${{ env.BIN_NAME }}_${{ steps.get_version.outputs }}-1_${{ matrix.target-apt-arch }}.deb
asset_name: ${{ env.BIN_NAME }}_${{ github.ref_name }}_${{ matrix.target-apt-arch }}.deb
tag: ${{ github.ref }}
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repository = "https://github.com/spencerwooo/bitsrun-rs"
readme = "README.md"
keywords = ["bit", "bitsrun", "srun", "srun-client", "srun-login"]
categories = ["command-line-utilities"]
authors = ["Spencer Woo <spencer.woo@outlook.com>"]

[dependencies]
reqwest = { version = "0.11", features = [
Expand Down Expand Up @@ -37,3 +38,6 @@ chrono = "0.4"

[profile.release]
strip = "symbols"

[package.metadata.deb]
copyright = "2023 Spencer Woo"

0 comments on commit d57afe3

Please sign in to comment.