@settlekit/common, @settlekit/sdk and @settlekit/react move to 0.1.0 with publish metadata (description, MIT licence, repository, public access, LICENSE and README in the tarball; verified with npm pack --dry-run). .github/workflows/release-sdks.yml publishes npm, PyPI (trusted publishing) and crates.io on an sdk-v* tag or as a manual dry run. docs/RELEASING-SDKS.md lists the owner-only registry setup. Nothing is published from here. The Python, Go and Rust webhook verifiers already accept rotated secrets (G8). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
2.7 KiB
YAML
83 lines
2.7 KiB
YAML
# Publish the SettleKit SDKs when a tag like sdk-v0.1.0 is pushed.
|
|
#
|
|
# Needs repository secrets set by the owner:
|
|
# NPM_TOKEN npm automation token with publish rights on @settlekit
|
|
# CARGO_REGISTRY_TOKEN crates.io API token
|
|
# PyPI uses trusted publishing (configure the "settlekit" project on PyPI to
|
|
# trust this workflow); no token is stored.
|
|
# Go: the module path is github.com/settlekit/settlekit-go, so the Go SDK is
|
|
# released by mirroring sdks/go to that repository and tagging it there.
|
|
name: release-sdks
|
|
|
|
on:
|
|
push:
|
|
tags: ["sdk-v*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
dry_run:
|
|
description: "Build and pack without publishing"
|
|
type: boolean
|
|
default: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
npm:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
registry-url: https://registry.npmjs.org
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm --filter @settlekit/common --filter @settlekit/sdk --filter @settlekit/react build
|
|
- run: pnpm vitest run packages/common packages/sdk packages/webhooks
|
|
- name: Publish (common first, then sdk and react)
|
|
if: ${{ github.event_name == 'push' || !inputs.dry_run }}
|
|
run: |
|
|
pnpm --filter @settlekit/common publish --access public --no-git-checks
|
|
pnpm --filter @settlekit/sdk --filter @settlekit/react publish --access public --no-git-checks
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
- name: Pack (dry run)
|
|
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
|
|
run: pnpm --filter @settlekit/sdk --filter @settlekit/react --filter @settlekit/common pack
|
|
|
|
pypi:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
defaults:
|
|
run:
|
|
working-directory: sdks/python
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: python -m pip install build
|
|
- run: python -m build
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
if: ${{ github.event_name == 'push' || !inputs.dry_run }}
|
|
with:
|
|
packages-dir: sdks/python/dist
|
|
|
|
crates:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: sdks/rust
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- run: cargo test
|
|
- run: cargo publish --dry-run
|
|
- run: cargo publish
|
|
if: ${{ github.event_name == 'push' || !inputs.dry_run }}
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|