diff --git a/.github/workflows/build-for-release.yml b/.github/workflows/build-for-release.yml new file mode 100644 index 0000000..7d9b92c --- /dev/null +++ b/.github/workflows/build-for-release.yml @@ -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 }}