try: release #8
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: 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 }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
${{ matrix.os == 'windows-latest' && 'target/release/peerban.exe' || 'target/release/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 }} |