Rust Build and Release #13
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: 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: Build & Rename | ||
shell: bash | ||
run: | | ||
Check failure on line 25 in .github/workflows/build.yaml GitHub Actions / Rust Build and ReleaseInvalid workflow file
|
||
cargo build --profile opt --target ${{ matrix.target }} | ||
mkdir -p build | ||
EXECUTABLE=$(find target -maxdepth 2 -type f -executable | head -n 1) | ||
cp "$EXECUTABLE" "build/peerban-${{ matrix.target }}${{ matrix.os == 'windows-latest' && echo '.exe' || echo '' }}" | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.target }} | ||
path: build/* | ||
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 }} |