Skip to content

Workflow file for this run

name: Build and publish WASM package
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: Get version
id: version
shell: bash
run: echo ::set-output name=VERSION::"$([[ "$GITHUB_REF" == refs/tags/v* ]] && echo ${GITHUB_REF#refs/tags/v} || echo '0.0.0')"
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Install wasm-pack
working-directory: ./minify-html-wasm
shell: bash
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build native module
working-directory: ./minify-html-wasm
shell: bash
run: TARGET=bundler ./build
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 17.x
- name: Pack and publish package
working-directory: ./minify-html-wasm/pkg
run: |
cat << 'EOF' > .npmrc
package-lock=false
//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
EOF
# npm refuses to work with symlinks.
cp ../../README.md .
if [[ "${{ steps.version.outputs.VERSION }}" != "0.0.0" ]]; then
npm publish --access public
fi