diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8909e0c..3ed35be 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -96,8 +96,27 @@ jobs: name: bindings-${{ matrix.settings.target }} path: "./packages/critters/dist/*.node" if-no-files-found: error - publish: - name: Publish + + publish-rust: + name: Publish to Crates.io + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + steps: + - uses: actions/checkout@v4 + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - name: Rust tests + run: cargo test --verbose + - name: Rust publish + run: cargo publish --token ${CRATES_TOKEN} + env: + CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} + + publish-npm: + name: Publish to NPM runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' needs: @@ -115,6 +134,8 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: stable + + # NPM Publish - name: Install dependencies run: pnpm install - name: Download all artifacts @@ -132,7 +153,7 @@ jobs: run: pnpm build - name: View Git Changes run: git status - - name: Publish + - name: Publish NPM run: | npm config set provenance true if git log -1 --pretty=%B | grep "release main";