Skip to content

Commit

Permalink
Produce a deb package as part of release
Browse files Browse the repository at this point in the history
  • Loading branch information
benmoss committed Feb 2, 2023
1 parent 5f9ac39 commit 19cbd2c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
strip = { path = "aarch64-linux-gnu-strip" }

[target.armv7-unknown-linux-musl]
linker = "arm-linux-gnueabihf-gcc"
strip = { path = "arm-linux-gnueabihf-strip" }
5 changes: 4 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- '*'
Expand Down Expand Up @@ -83,7 +84,9 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
files: |
${{ steps.package.outputs.archive }}
${{ steps.package.outputs.deb }}
prerelease: ${{ steps.ref-type.outputs.value != 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
29 changes: 18 additions & 11 deletions bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euxo pipefail

VERSION=${REF#"refs/tags/"}
DIST=`pwd`/dist
DIST=$(pwd)/dist

echo "Packaging just $VERSION for $TARGET..."

Expand All @@ -14,6 +14,13 @@ RUSTFLAGS="--deny warnings --codegen target-feature=+crt-static $TARGET_RUSTFLAG
cargo build --bin just --target $TARGET --release
EXECUTABLE=target/$TARGET/release/just

if [[ $OS == ubuntu-latest ]]; then
cargo install cargo-deb
RUSTFLAGS="--deny warnings --codegen target-feature=+crt-static $TARGET_RUSTFLAGS" \
cargo deb --target $TARGET --no-build
echo "deb=$(find . -name '*.deb')" >>$GITHUB_OUTPUT
fi

if [[ $OS == windows-latest ]]; then
EXECUTABLE=$EXECUTABLE.exe
fi
Expand All @@ -33,14 +40,14 @@ cp \
cd $DIST
echo "Creating release archive..."
case $OS in
ubuntu-latest | macos-latest)
ARCHIVE=$DIST/just-$VERSION-$TARGET.tar.gz
tar czf $ARCHIVE *
echo "::set-output name=archive::$ARCHIVE"
;;
windows-latest)
ARCHIVE=$DIST/just-$VERSION-$TARGET.zip
7z a $ARCHIVE *
echo "::set-output name=archive::`pwd -W`/just-$VERSION-$TARGET.zip"
;;
ubuntu-latest | macos-latest)
ARCHIVE=$DIST/just-$VERSION-$TARGET.tar.gz
tar czf $ARCHIVE *
echo "archive=$ARCHIVE" >>$GITHUB_OUTPUT
;;
windows-latest)
ARCHIVE=$DIST/just-$VERSION-$TARGET.zip
7z a $ARCHIVE *
echo "archive=$(pwd -W)/just-$VERSION-$TARGET.zip" >>$GITHUB_OUTPUT
;;
esac

0 comments on commit 19cbd2c

Please sign in to comment.