This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
remove example from workspace #51
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 | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# permissions: | |
# contents: read | |
# packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: jetli/[email protected] | |
with: | |
# Optional version of wasm-pack to install(eg. 'v0.9.1', 'latest') | |
version: 'latest' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
- name: Config registry | |
run: echo "@arturoc:registry=https://npm.pkg.github.com" >> ~/.npmrc | |
- name: Generate Cargo.lock | |
run: cargo update | |
- name: Retrieve pkg name | |
run: echo "PKG_NAME=$(cargo pkgid | sed 's/.*#\(.*\)@\(.*\)/\1/g')" >> $GITHUB_ENV | |
- name: Retrieve version | |
run: echo "PKG_VERSION=$(cargo pkgid | sed 's/.*@\(.*\)/\1/g')" >> $GITHUB_ENV | |
- name: Retrieve last published version | |
if: always() | |
run: echo "PUBLISHED_VERSION=$(if npm view --registry https://npm.pkg.github.com @novorender/${{ env.PKG_NAME }} version 2> /dev/null; then echo ''; else echo '0.0.0'; fi)" >> $GITHUB_ENV | |
- name: Build | |
if: env.PKG_VERSION != env.PUBLISHED_VERSION | |
run: wasm-pack build --scope=novorender --target bundler | |
- name: Publish package | |
if: env.PKG_VERSION != env.PUBLISHED_VERSION | |
run: wasm-pack publish --access=public | |
# use npm instead of wasm-pack to publish: | |
# run: npm --userconfig ~/.npmrc --registry https://npm.pkg.github.com publish ./pkg --access public | |