-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): Add Release Pipeline (NPM) #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
13f8bf2
e313751
4267f72
c8724ee
b0fc44c
324a0c2
f5d86de
fa1b0e4
059ac8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: "Build" | ||
| description: "Sets up environment and builds the WASM package" | ||
|
|
||
| inputs: | ||
| github-app-token: | ||
| description: "GitHub App token for private git deps" | ||
| required: false | ||
| default: "" | ||
| configure-git-user: | ||
| description: "Configure git user for commits" | ||
| required: false | ||
| default: "false" | ||
| node-version: | ||
| description: "Node.js version to install" | ||
| required: false | ||
| default: "24" | ||
| setup-npm-registry: | ||
| description: "Setup NPM registry URL" | ||
| required: false | ||
| default: "false" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Configure git for GitHub App auth (private deps and push) | ||
| if: ${{ inputs.github-app-token != '' }} | ||
| shell: bash | ||
| env: | ||
| BULLET_APP_TOKEN: ${{ inputs.github-app-token }} | ||
| run: | | ||
| git config --global --add url."https://x-access-token:${BULLET_APP_TOKEN}@github.com/".insteadOf "ssh://git@github.com/" | ||
| git config --global --add url."https://x-access-token:${BULLET_APP_TOKEN}@github.com/".insteadOf "git@github.com:" | ||
| git config --global --add url."https://x-access-token:${BULLET_APP_TOKEN}@github.com/".insteadOf "https://github.com/" | ||
|
cursor[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which dependencies are needing these?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None, good point, this was copied from the old js sdk |
||
| - name: Configure Git user | ||
| if: ${{ inputs.configure-git-user == 'true' }} | ||
| shell: bash | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ inputs.node-version }} | ||
| registry-url: ${{ inputs.setup-npm-registry == 'true' && 'https://registry.npmjs.org' || '' }} | ||
|
|
||
| - name: Setup Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: wasm32-unknown-unknown | ||
|
|
||
| - name: Rust cache | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install cargo-binstall | ||
| uses: cargo-bins/cargo-binstall@main | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unpinned third-party action in release publish pipelineMedium Severity
Reviewed by Cursor Bugbot for commit 059ac8f. Configure here. |
||
|
|
||
| - name: Install wasm-pack | ||
| shell: bash | ||
| run: cargo binstall wasm-pack -y | ||
|
|
||
| - name: Install just | ||
| uses: extractions/setup-just@v2 | ||
|
|
||
| - name: Install npm dependencies | ||
| shell: bash | ||
| working-directory: ./wasm | ||
| run: npm install | ||
|
|
||
| - name: Build WASM | ||
| shell: bash | ||
| run: just build-wasm | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # NPM publishing uses OIDC Trusted Publishers for authentication (no NPM_TOKEN needed). | ||
| # Configure the Trusted Publisher at https://www.npmjs.com/package/@bulletxyz/sdk-wasm/access | ||
| # See: https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | ||
|
|
||
| name: NPM Publish | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: "Branch to build and publish from" | ||
| required: true | ||
| default: "main" | ||
| type: string | ||
| level: | ||
| description: "Release level" | ||
| required: true | ||
| default: "patch" | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| - rc | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
| CI: 1 | ||
|
|
||
| concurrency: | ||
| group: npm-publish | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.branch }} | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Create GitHub App Token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v1 | ||
| with: | ||
| app-id: ${{ vars.BULLET_DEPLOY_APP_ID }} | ||
| private-key: ${{ secrets.BULLET_DEPLOY_KEY }} | ||
| owner: ${{ github.repository_owner }} | ||
|
|
||
| - name: Configure git | ||
| env: | ||
| GITHUB_APP_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: | | ||
| git config user.name "bullet-deploy[bot]" | ||
| git config user.email "${{ vars.BULLET_DEPLOY_APP_ID }}+bullet-deploy[bot]@users.noreply.github.com" | ||
| git config --global url."https://x-access-token:${GITHUB_APP_TOKEN}@github.com/".insteadOf "https://github.com/" | ||
|
|
||
| - name: Build | ||
| uses: ./.github/actions/build | ||
| with: | ||
| github-app-token: ${{ steps.app-token.outputs.token }} | ||
| setup-npm-registry: "true" | ||
|
|
||
| - name: Install cargo-edit | ||
| run: cargo binstall cargo-edit -y | ||
|
|
||
| - name: Bump + publish to npm | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: OIDC trusted publishing will fail with Prompt for AI agents |
||
| run: just publish-wasm ${{ inputs.level }} | ||
|
cursor[bot] marked this conversation as resolved.
Outdated
cursor[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Commit, tag, and push | ||
| run: | | ||
| V=$(cargo pkgid -p bullet-rust-sdk-wasm | cut -d@ -f2) | ||
| git add Cargo.toml rust/Cargo.toml wasm/Cargo.toml wasm/package.json | ||
|
cursor[bot] marked this conversation as resolved.
Outdated
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
|
||
| git commit -m "v${V} [skip ci]" | ||
| git tag -m "v${V}" "v${V}" | ||
| git push --follow-tags | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,12 @@ | |
| members = ["rust", "wasm"] | ||
| resolver = "2" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can upgrade this to 3 now with latest rust versions (we just moved to rust 1.94) |
||
|
|
||
| [workspace.package] | ||
| version = "0.0.9" | ||
|
cursor[bot] marked this conversation as resolved.
Outdated
|
||
| edition = "2024" | ||
| license = "MIT" | ||
| repository = "https://github.com/bulletxyz/bullet-rust-sdk" | ||
|
|
||
| [workspace.dependencies] | ||
| bon = "3.9.0" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,7 @@ | |
| packages = [ | ||
| rust | ||
| pkgs.cargo-nextest | ||
| pkgs.cargo-edit | ||
| pkgs.just | ||
| (makeWasmPack pkgs) | ||
| pkgs.pkg-config | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not need this if all outputs are public.