0.13.0 #21
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
on: | |
push: | |
tags: | |
- 'v*' # Run when tag matches v*, i.e. v1.0, v20.15.10 | |
name: Release | |
env: | |
RELEASE_BIN: wasm-pack | |
RELEASE_DIR: artifacts | |
GITHUB_REF: '${{ github.ref }}' | |
WINDOWS_TARGET: x86_64-pc-windows-msvc | |
MACOS_TARGET: x86_64-apple-darwin | |
LINUX_AMD64_TARGET: x86_64-unknown-linux-musl | |
LINUX_ARM64_TARGET: aarch64-unknown-linux-musl | |
# Space separated paths to include in the archive. | |
RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT | |
jobs: | |
build: | |
name: Build artifacts | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
rust: stable | |
- target: aarch64-unknown-linux-musl | |
os: ubuntu-latest | |
rust: stable | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
rust: stable | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
rust: stable | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
targets: wasm32-unknown-unknown | |
- name: Query version number | |
id: get_version | |
shell: bash | |
run: | | |
echo "using version tag ${GITHUB_REF:10}" | |
echo ::set-output name=version::"${GITHUB_REF:10}" | |
- name: Install C compilation tooling (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y clang gcc-aarch64-linux-gnu g++-aarch64-linux-gnu musl-tools | |
echo "TARGET_CC=clang" >> $GITHUB_ENV | |
echo "CFLAGS_aarch64_unknown_linux_musl=--sysroot=/usr/aarch64-linux-gnu" >> $GITHUB_ENV | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/aarch64-linux-gnu/bin/ld" >> $GITHUB_ENV | |
- name: Install p7zip (MacOS) | |
if: matrix.os == 'macos-latest' | |
run: brew install p7zip | |
- name: Add rustup target | |
run: rustup target add ${{ matrix.target }} | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Set RUSTFLAGS (Windows) | |
if: matrix.os == 'windows-latest' | |
run: echo "RUSTFLAGS=-Ctarget-feature=+crt-static" >> $GITHUB_ENV | |
- name: Create artifact directory | |
run: | | |
mkdir ${{ env.RELEASE_DIR }} | |
mkdir -p ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | |
- name: Move binaries (Linux/MacOS) | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
run: | | |
mv ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }} | |
mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | |
- name: Move binaries (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: bash | |
run: | | |
cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}/${{ env.RELEASE_BIN }}.exe | |
cp ./target/${{ matrix.target }}/release/${{ env.RELEASE_BIN }}.exe wasm-pack-init.exe | |
mv ${{ env.RELEASE_ADDS }} ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | |
mv wasm-pack-init.exe ${{ env.RELEASE_DIR }} | |
- name: Create tarball | |
shell: bash | |
run: 7z a -ttar -so -an ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }} | 7z a -si ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz | |
- name: Upload Zip | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.target }} | |
path: ./${{ env.RELEASE_DIR }} | |
release: | |
name: GitHub Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Query version number | |
id: get_version | |
shell: bash | |
run: | | |
echo "using version tag ${GITHUB_REF:10}" | |
echo ::set-output name=version::"${GITHUB_REF:10}" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
release_name: ${{ steps.get_version.outputs.VERSION }} | |
- name: Download Linux amd64 tarball | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ env.LINUX_AMD64_TARGET }} | |
- name: Download Linux arm64 tarball | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ env.LINUX_ARM64_TARGET }} | |
- name: Download Windows tarball | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ env.WINDOWS_TARGET }} | |
- name: Download MacOS tarball | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ env.MACOS_TARGET }} | |
- name: Release Linux amd64 tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz | |
asset_content_type: application/gzip | |
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}.tar.gz | |
- name: Release Linux arm64 tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz | |
asset_content_type: application/gzip | |
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_ARM64_TARGET }}.tar.gz | |
- name: Release Windows tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz | |
asset_content_type: application/gzip | |
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.WINDOWS_TARGET }}.tar.gz | |
- name: Release Windows init exe | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wasm-pack-init.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |
asset_name: wasm-pack-init.exe | |
- name: Release MacOS tarball | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz | |
asset_content_type: application/gzip | |
asset_name: wasm-pack-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}.tar.gz |