Skip to content

Commit

Permalink
Create build-for-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
avborup committed Nov 23, 2021
1 parent 3070c29 commit c876845
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-for-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and upload binaries to release

on:
release:
types: [published]

jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
- os: windows-latest
artifact_name: network-stability-logger.exe
asset_name: network-stability-logger-x86_64-pc-windows-msvc.exe
- os: ubuntu-latest
artifact_name: network-stability-logger
asset_name: network-stability-logger-x86_64-unknown-linux-gnu
- os: macos-latest
artifact_name: network-stability-logger
asset_name: network-stability-logger-x86_64-apple-darwin

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install latest Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true

- name: Build binary
run: cargo build --release

- name: Strip binary
if: runner.os == 'Linux' || runner.os == 'macOS'
run: strip target/release/${{ matrix.artifact_name }}

- name: Upload binary to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.event.release.tag_name }}

0 comments on commit c876845

Please sign in to comment.