Skip to content

Rust Build and Release #9

Rust Build and Release

Rust Build and Release #9

Workflow file for this run

name: Rust Build and Release
on:
push:
paths:
- '**/*.rs'
- 'Cargo.toml'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# - name: Set up Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# target: ${{ matrix.target }}
# override: true
- name: Build
run: |
cargo build --release --target ${{ matrix.target }}
tree target
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
${{ matrix.os == 'windows-latest' && 'target/*/peerban.exe' || 'target/*/peerban' }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: release_binaries
- name: Get version
run: |
echo "VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" > $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release_binaries/**
tag_name: ${{ env.VERSION }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}