Add CI/CD

This commit is contained in:
Daniel Kluge 2024-01-06 11:27:48 +01:00
parent c0fe46cf34
commit 75d3759657

View File

@ -0,0 +1,45 @@
name: Publish npm package
on:
release:
types: [published]
jobs:
build-and-publish:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout code
- name: Setup node and npm
uses: actions/setup-node@v3
with:
node-version: "21.x"
registry-url: "https://git.c0ntroller.de/api/packages/c0ntroller/npm/"
scope: "@c0ntroller"
- id: cache-rustup
name: Cache Rust toolchain
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.rustup
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: wasm-pack build --target web --release --scope c0ntroller
- name: Publish
run: wasm-pack publish
env:
NODE_AUTH_TOKEN: ${{ secrets.LOCAL_NPM }}