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 static build macOS and Linux | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: build for all platforms | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
BINARY_NAME: echtvar | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set build version | |
id: version | |
shell: bash | |
run: | | |
VERSION="$(cat Cargo.toml | grep 'version =' -m 1 | sed 's@version =@@' | xargs)" | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
echo "::notice::publish build version $VERSION" | |
- uses: actions/checkout@v2 | |
- name: Build-musl macOS x86 | |
uses: Shogan/rust-musl-action@v1.0.2 | |
with: | |
args: cargo build --target x86_64-apple-darwin --release | |
- name: Build-musl Linux x86 | |
uses: Shogan/rust-musl-action@v1.0.2 | |
with: | |
args: cargo build --target x86_64-unknown-linux-musl --release | |
# - name: Upload macOS x86 binary to release | |
# uses: Spikatrix/upload-release-action@b713c4b73f0a8ddda515820c124efc6538685492 | |
# with: | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# file: target/x86_64-apple-darwin/release/${{ env.BINARY_NAME }} | |
# asset_name: ${{ env.BINARY_NAME }}-macos-x86 | |
# target_commit: ${{ github.sha }} | |
# tag: v${{ env.RELEASE_VERSION }} | |
# release_name: v${{ env.RELEASE_VERSION }} | |
# prerelease: false | |
# overwrite: true | |
# body: ${{ env.BINARY_NAME }} release | |
- name: Upload linux binary to release | |
uses: Spikatrix/upload-release-action@b713c4b73f0a8ddda515820c124efc6538685492 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }} | |
asset_name: ${{ env.BINARY_NAME }} | |
target_commit: ${{ github.sha }} | |
tag: v${{ env.RELEASE_VERSION }} | |
release_name: v${{ env.RELEASE_VERSION }} | |
prerelease: false | |
overwrite: true | |
body: ${{ env.BINARY_NAME }} release | |