Build and Release truss-transfer CLI #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release truss-transfer CLI | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
defaults: | |
run: | |
working-directory: truss-transfer | |
jobs: | |
build-and-upload-cli: | |
name: Build and Upload CLI Binary | |
runs-on: ubuntu-latest | |
env: | |
VERSION: ${{ github.ref_name }} # or ${GITHUB_REF##*/}, see note below | |
OS: linux | |
ARCH: x86_64 | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Install musl-tools | |
run: sudo apt-get update && sudo apt-get install -y musl-tools | |
- name: Install Rust with musl target | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rust-src | |
- name: Add musl Target | |
run: rustup target add x86_64-unknown-linux-musl | |
- name: Build Statically Linked CLI Binary | |
run: | | |
cargo build --release --target x86_64-unknown-linux-musl --features cli --bin truss_transfer_cli | |
mkdir -p dist/cli | |
cp target/x86_64-unknown-linux-musl/release/truss_transfer_cli dist/cli/truss_transfer_cli-${VERSION}-${OS}-${ARCH} | |
- name: Test CLI Binary | |
run: | | |
sudo mkdir -p /bptr | |
sudo chown $(whoami):$(whoami) /bptr | |
cp ./example-bptr-manifest.json /bptr/bptr-manifest | |
dist/cli/truss_transfer_cli-${VERSION}-${OS}-${ARCH} ./example_bptr_resolved | |
if [ ! -d "./example_bptr_resolved" ]; then | |
echo "❌ Test failed: output directory not created." | |
exit 1 | |
fi | |
- name: Upload CLI to GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: truss-transfer/dist/cli/truss_transfer_cli-* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |