name: Release Statically Linked Rust Binary
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl - aarch64-unknown-linux-musl
env:
BINARY_NAME: python-cleaner
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Cross
run: cargo install cross
- name: Install Target for Cross Compilation
run: rustup target add ${{ matrix.target }}
- name: Build with Cross
run: cross build --target ${{ matrix.target }} --release --verbose
- name: Create Release Archive
run: |
mkdir -p release
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
cp target/${{ matrix.target }}/release/$BINARY_NAME.exe release/
zip -r ${{ matrix.target }}.zip release
elif [[ "${{ matrix.target }}" == *"darwin"* ]]; then
cp target/${{ matrix.target }}/release/$BINARY_NAME release/
tar -czvf ${{ matrix.target }}.tar.gz -C release $BINARY_NAME
else
cp target/${{ matrix.target }}/release/$BINARY_NAME release/
tar -czvf ${{ matrix.target }}.tar.gz -C release $BINARY_NAME
fi
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: |
*.tar.gz