adding npm publish and crates publishing

This commit is contained in:
Andy Pack 2025-02-15 20:50:59 +00:00
parent ff71ffb7d5
commit 2289ca5e55
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 65 additions and 3 deletions
.gitea/workflows
.github/workflows
finlib

@ -157,4 +157,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: publish
args: --package finlib
args: --package finlib --registry sargit

@ -129,4 +129,67 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
publishNPM:
name: Publish NPM
runs-on: ubuntu-latest
needs: [ buildWASM ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Rust for WASM
working-directory: ./finlib-wasm
run: wasm-pack build --release
- name: Change Package Name
working-directory: ./finlib-wasm
run: ./rename-pkg.sh
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 22
- name: Publish
working-directory: ./finlib-wasm/pkg
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publishRustLib:
runs-on: ubuntu-latest
name: Publish Rust Library
needs: [ build ] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Add Crates.io Credentials
run: |
cat <<EOF > ~/.cargo/credentials.toml
[registry]
token = "Bearer ${{ secrets.CRATES_TOKEN }}"
EOF
- name: Cargo Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --package finlib

@ -1,6 +1,5 @@
[package]
name = "finlib"
publish = ["sargit"]
version.workspace = true
authors.workspace = true
edition.workspace = true