Skip to content

Commit

Permalink
ci: add job to publish to crates-io
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylfwood committed Mar 5, 2024
1 parent 6ceb337 commit 020ca85
Showing 1 changed file with 32 additions and 21 deletions.
53 changes: 32 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Publish Package

on:
push:
workflow_dispatch:
inputs:
beta:
Expand All @@ -10,32 +11,42 @@ on:
type: boolean

jobs:
npmjs:
environment: npm-publish
# npmjs:
# environment: npm-publish
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: wasm

# steps:
# - uses: actions/checkout@v4

# - name: Install dependencies
# run: cargo install wasm-pack
# working-directory: wasm

# - name: Configure NPM
# run: npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"

# - name: Build
# run: ./build.sh
# working-directory: wasm

# - name: Publish
# run: npm publish --tag ${{ inputs.beta && 'beta' || 'latest' }}
# working-directory: dist/bundler

crates-io:
environment: crates-publish
runs-on: ubuntu-latest
defaults:
run:
working-directory: wasm

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: cargo install wasm-pack
working-directory: wasm

- name: Configure NPM
run: npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"

- name: Build
run: ./build.sh
working-directory: wasm
run: cargo login
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

- name: Publish
run: npm publish --tag ${{ inputs.beta && 'beta' || 'latest' }}
working-directory: dist/bundler

- uses: actions/upload-artifact@v4
with:
name: npm-bundler
path: dist/bundler
run: cargo publish --dry-run

0 comments on commit 020ca85

Please sign in to comment.