Merge pull request #14 from Angelin01/ci #1
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' # Trigger on tags that start with 'v' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- TARGET: x86_64-unknown-linux-gnu | |
- TARGET: x86_64-unknown-linux-musl | |
- TARGET: aarch64-unknown-linux-gnu | |
- TARGET: aarch64-unknown-linux-musl | |
- TARGET: armv7-unknown-linux-gnueabihf | |
name: Build and Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install Dependencies | |
run: | | |
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf | |
cat >>~/.cargo/config <<EOF | |
[target.aarch64-unknown-linux-gnu] | |
linker = "aarch64-linux-gnu-gcc" | |
[target.aarch64-unknown-linux-musl] | |
linker = "aarch64-linux-gnu-gcc" | |
[target.armv7-unknown-linux-gnueabihf] | |
linker = "arm-linux-gnueabihf-gcc" | |
[target.armv7-unknown-linux-musleabihf] | |
linker = "arm-linux-gnueabihf-gcc" | |
EOF | |
- name: Install rust target | |
run: rustup target add $TARGET | |
- name: Set version | |
run: | | |
tagName=${GITHUB_REF#refs/tags/v} | |
sed -i 's;version\s*=\s*"0.0.0";version = "'"${tagName}"'";' Cargo.toml | |
cargo update gjallarbot | |
- name: Build | |
run: cargo build --locked --release --target $TARGET | |
- name: Package | |
run: | | |
tagName=${GITHUB_REF#refs/tags/v} | |
executableName=gjallarbot | |
mkdir -p dist | |
mv target/release/$executableName dist/${executableName}-v${tagName}-${TARGET} | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ./dist | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
files: ./dist/* |