Initial commit
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
name: Test and release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Run cargo test
|
||||
run: cargo test --verbose
|
||||
|
||||
build-and-release:
|
||||
name: Build and Release
|
||||
needs: test
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
releases: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
run: |
|
||||
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$PREVIOUS_TAG" ]; then
|
||||
echo "No previous tag found. Generating log from beginning of history."
|
||||
git log --pretty=format:"* %s (%h)" | tee -a changelog.md
|
||||
else
|
||||
echo "Generating changes since $PREVIOUS_TAG"
|
||||
git log "$PREVIOUS_TAG..HEAD" --pretty=format:"* %s (%h)" | tee -a changelog.md
|
||||
fi
|
||||
|
||||
echo "CHANGELOG_FILE=changelog.md" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: "x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu"
|
||||
|
||||
- name: Install AArch64 linker (for Arm64 cross-compilation)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
|
||||
- name: Build Release Binaries
|
||||
env:
|
||||
# Tell Cargo to use the AArch64 linker when building for Arm64
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: |
|
||||
cargo build --release --target x86_64-unknown-linux-gnu
|
||||
cargo build --release --target aarch64-unknown-linux-gnu
|
||||
|
||||
- name: Prepare binaries for release
|
||||
run: |
|
||||
BIN_NAME="shy-launcher"
|
||||
|
||||
mv target/x86_64-unknown-linux-gnu/release/$BIN_NAME $BIN_NAME-x86_64-unknown-linux-gnu
|
||||
mv target/aarch64-unknown-linux-gnu/release/$BIN_NAME $BIN_NAME-aarch64-unknown-linux-gnu
|
||||
|
||||
- name: Create / Update Release and Upload Assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: ${{ env.CHANGELOG_FILE }}
|
||||
files: |
|
||||
shy-launcher-aarch64-unknown-linux-gnu
|
||||
shy-launcher-x86_64-unknown-linux-gnu
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user