From 020ca850b6c3546d5298dd71e219acbbe127ccf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Larivi=C3=A8re?= Date: Tue, 5 Mar 2024 11:11:49 -0500 Subject: [PATCH] ci: add job to publish to crates-io --- .github/workflows/publish.yml | 53 +++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e104227..50e53c5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,7 @@ name: Publish Package on: + push: workflow_dispatch: inputs: beta: @@ -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