Skip to content

Commit

Permalink
ci: add rust publish stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Thomas committed Dec 30, 2024
1 parent eb4412b commit b78f10c
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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";
Expand Down

0 comments on commit b78f10c

Please sign in to comment.