0.6.14 #44
Workflow file for this run
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
# Workflow was stolen from Rojo. Thanks Rojo! | |
name: Release | |
on: | |
push: | |
tags: ["v*"] | |
permissions: | |
contents: write | |
jobs: | |
create-release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: false | |
build: | |
needs: ["create-release"] | |
strategy: | |
fail-fast: false | |
matrix: | |
# https://doc.rust-lang.org/rustc/platform-support.html | |
include: | |
- host: linux | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
label: linux-x86_64 | |
- host: windows | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
label: windows-x86_64 | |
- host: macos | |
os: macos-latest | |
target: x86_64-apple-darwin | |
label: macos-x86_64 | |
- host: macos | |
os: macos-latest | |
target: aarch64-apple-darwin | |
label: macos-aarch64 | |
name: Build (${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
env: | |
BIN: zap | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Version from Tag | |
shell: bash | |
# https://github.community/t/how-to-get-just-the-tag-name/16241/7#M1027 | |
run: | | |
echo "PROJECT_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
echo "Version is: ${{ env.PROJECT_VERSION }}" | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
override: true | |
profile: minimal | |
- name: Build Release | |
run: cargo build --release --locked --verbose --target ${{ matrix.target }} --package cli | |
env: | |
# Build into a known directory so we can find our build artifact more | |
# easily. | |
CARGO_TARGET_DIR: output | |
- name: Create Release Archive | |
shell: bash | |
run: | | |
mkdir staging | |
if [ "${{ matrix.host }}" = "windows" ]; then | |
cp "output/${{ matrix.target }}/release/$BIN.exe" staging/ | |
cd staging | |
7z a ../release.zip * | |
else | |
cp "output/${{ matrix.target }}/release/$BIN" staging/ | |
cd staging | |
zip ../release.zip * | |
fi | |
- name: Upload Archive to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: release.zip | |
asset_name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-${{ matrix.label }}.zip | |
asset_content_type: application/octet-stream | |
- name: Upload Archive to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-${{ matrix.label }}.zip | |
path: release.zip | |
build-wasm: | |
name: Build WASM | |
runs-on: ubuntu-latest | |
needs: ["create-release"] | |
env: | |
BIN: zap | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Version from Tag | |
shell: bash | |
# https://github.community/t/how-to-get-just-the-tag-name/16241/7#M1027 | |
run: | | |
echo "PROJECT_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
echo "Version is: ${{ env.PROJECT_VERSION }}" | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
profile: minimal | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Build Release | |
run: | | |
wasm-pack build zap | |
wasm-pack pack zap | |
- name: Upload Archive to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-release.outputs.upload_url }} | |
asset_path: zap/pkg/${{ env.BIN }}-${{ env.PROJECT_VERSION }}.tgz | |
asset_name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-wasm.tgz | |
asset_content_type: application/octet-stream | |
- name: Upload Archive to Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-wasm.tgz | |
path: zap/pkg/${{ env.BIN }}-${{ env.PROJECT_VERSION }}.tgz |