Skip to content

Make runner config idempotent #6

Make runner config idempotent

Make runner config idempotent #6

Workflow file for this run

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
env:
TARGET: ${{ matrix.TARGET }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install Dependencies
run: |
sudo apt-get install -yqq crossbuild-essential-arm64 crossbuild-essential-armhf musl-tools
cat > ~/.cargo/config.toml <<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/$TARGET/release/$executableName dist/${executableName}-v${tagName}-${TARGET}
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.TARGET }}
path: dist/
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: binary-*
path: ./dist/
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: ./dist/*