Build and Release versa-wasm #4
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 versa-wasm | |
on: | |
workflow_dispatch: | |
inputs: | |
major: | |
description: "Major Version" | |
required: true | |
minor: | |
description: "Minor Version" | |
required: true | |
patch: | |
description: "Patch Version" | |
required: true | |
jobs: | |
build-and-release-wasm: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
# - os: ubuntu-latest | |
# target: aarch64-unknown-linux-musl | |
# - os: macos-latest | |
# target: x86_64-apple-darwin | |
# - os: macos-latest | |
# target: aarch64-apple-darwin | |
# - os: windows-latest | |
# target: x86_64-pc-windows-msvc | |
# - os: windows-latest | |
# target: aarch64-pc-windows-msvc | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Cross-Compilation for aarch64-linux-musl | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y musl-tools | |
echo "[target.aarch64-unknown-linux-musl]" >> ~/.cargo/config | |
echo "linker = 'aarch64-linux-musl-gcc'" >> ~/.cargo/config | |
- name: Install musl-tools for x86_64-unknown-linux-musl | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: sudo apt-get install musl-tools | |
- name: Configure Environment for musl Target | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
echo "CC_x86_64-unknown-linux-musl=musl-gcc" >> $GITHUB_ENV | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Build wasm_cli | |
run: | | |
cd crates/wasm_cli | |
cargo build --release --target ${{ matrix.target }} | |
- name: Create Release (runs only once) | |
if: github.event.inputs.major && github.event.inputs.minor && github.event.inputs.patch && matrix.target == 'x86_64-unknown-linux-gnu' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.major }}.${{ github.event.inputs.minor }}.${{ github.event.inputs.patch }} | |
release_name: Release v${{ github.event.inputs.major }}.${{ github.event.inputs.minor }}.${{ github.event.inputs.patch }} | |
draft: true | |
prerelease: true | |
- name: Upload Release Asset | |
if: steps.create_release.outputs.upload_url | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/${{ matrix.target }}/release/versa-wasm | |
asset_name: versa-wasm-${{ matrix.target }} | |
asset_content_type: application/octet-stream |