build and release #12
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: build and release | |
on: | |
workflow_dispatch: | |
release: | |
types: [ created ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os_name: Linux-aarch64 | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-musl | |
bin: wmproxy-linux-arm64 | |
depend: | | |
sudo apt-get update | |
sudo apt-get install -y libssl-dev | |
sudo apt-get install -y pkg-config | |
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/ | |
- os_name: Linux-x86_64 | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
bin: wmproxy-linux-amd64 | |
depend: | | |
sudo apt-get update | |
sudo apt-get install -y libssl-dev | |
- os_name: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
bin: wmproxy-amd64.exe | |
depend: | | |
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append | |
vcpkg install openssl:x64-windows-static-md | |
- os_name: macOS-x86_64 | |
os: macOS-latest | |
target: x86_64-apple-darwin | |
bin: wmproxy-darwin-amd64 | |
depend: echo "skip" | |
- os_name: macOS-aarch64 | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
bin: wmproxy-darwin-arm64 | |
depend: echo "skip" | |
toolchain: | |
- stable | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Depend | |
run: ${{ matrix.platform.depend }} | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
target: ${{ matrix.platform.target }} | |
toolchain: ${{ matrix.toolchain }} | |
args: " --release" | |
strip: true | |
- name: Rename binary (linux and macos) | |
run: mv target/${{ matrix.platform.target }}/release/wmproxy target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | |
if: matrix.platform.os_name != 'Windows-x86_64' | |
- name: Rename binary (windows) | |
run: mv target/${{ matrix.platform.target }}/release/wmproxy.exe target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | |
if: matrix.platform.os_name == 'Windows-x86_64' | |
- name: Generate SHA-256 | |
run: shasum -a 256 target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | cut -d ' ' -f 1 > target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256 | |
- name: Release binary and SHA-256 checksum to GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} | |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}.sha256 |