Skip to content

Workflow file for this run

name: Build and Release Rust CLI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [x86_64, aarch64] # ARM und x86_64 Architekturen
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: '1.70' # Setzen Sie hier die gewünschte Rust-Version ein
components: rustfmt, clippy
- name: Add target for cross-compilation
run: |
rustup target add ${{ matrix.arch }}-unknown-linux-gnu
rustup target add ${{ matrix.arch }}-apple-darwin
rustup target add ${{ matrix.arch }}-pc-windows-msvc
- name: Build
run: cargo build --release --target ${{ matrix.arch }}-${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.arch }}-${{ matrix.os }}
- name: Upload Release Artifacts
uses: actions/upload-artifact@v3
with:
name: dino_cli_game-${{ matrix.os }}-${{ matrix.arch }}
path: target/${{ matrix.arch }}-${{ matrix.os }}/release/dino_cli_game
- name: Create Release
if: success() && matrix.os == 'ubuntu-latest' # Create release only on Ubuntu
id: create_release
run: |
VERSION=$(date +'%Y-%m-%d')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
# Install GitHub CLI
sudo apt-get install gh
# Create the release
gh release create "${VERSION}" target/${{ matrix.arch }}-${{ matrix.os }}/release/dino_cli_game --title "Release ${VERSION}" --notes "Release created on ${VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}