Skip to content

fix(wallet-toolbox): expose spec op + brc114 helpers at index (#127) #11

fix(wallet-toolbox): expose spec op + brc114 helpers at index (#127)

fix(wallet-toolbox): expose spec op + brc114 helpers at index (#127) #11

Workflow file for this run

name: Release
on:
push:
tags:
- '**/v*' # e.g. packages/sdk/v1.2.3
- 'v*' # monorepo-wide tag (rare)
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # required for npm OIDC provenance
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm -r --filter '!@bsv/ts-stack' run build
- name: Resolve publish filter
id: publish-filter
run: |
tag="${GITHUB_REF_NAME}"
if [[ "$tag" == v* ]]; then
echo "filter=...[origin/main]" >> "$GITHUB_OUTPUT"
exit 0
fi
package_path="${tag%/v*}"
if [[ "$package_path" == "$tag" || ! -f "$package_path/package.json" ]]; then
echo "Could not resolve package path from tag: $tag" >&2
exit 1
fi
echo "filter=./$package_path" >> "$GITHUB_OUTPUT"
- name: Publish packages
# No token needed — npm authenticates via GitHub OIDC.
# Each package must have this repo configured as a trusted publisher
# on npmjs.org: package settings → Publishing → Add trusted publisher
# Owner: bsv-blockchain
# Repository: ts-stack
# Workflow: release.yaml
# Environment: (leave blank)
run: pnpm -r --filter="${{ steps.publish-filter.outputs.filter }}" publish --access public --no-git-checks --provenance
- name: Wait for npm registry propagation
run: sleep 300
- name: Sync published workspace versions
id: sync-versions
env:
SYNC_BRANCH: automation/sync-published-versions
run: |
git fetch origin main
git switch --force-create "$SYNC_BRANCH" origin/main
pnpm sync-versions
pnpm install --lockfile-only
if git diff --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add pnpm-lock.yaml 'packages/**/package.json'
git commit -m "chore: sync published workspace versions"
git push --force-with-lease origin "HEAD:$SYNC_BRANCH"
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "branch=$SYNC_BRANCH" >> "$GITHUB_OUTPUT"
- name: Open version sync PR
if: steps.sync-versions.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
SYNC_BRANCH: ${{ steps.sync-versions.outputs.branch }}
run: |
existing_pr="$(gh pr list --base main --head "$SYNC_BRANCH" --state open --json number --jq '.[0].number')"
if [[ -n "$existing_pr" ]]; then
gh pr edit "$existing_pr" \
--title "chore: sync published workspace versions" \
--body "Updates workspace package references and pnpm-lock.yaml after a successful npm publish."
else
gh pr create \
--base main \
--head "$SYNC_BRANCH" \
--title "chore: sync published workspace versions" \
--body "Updates workspace package references and pnpm-lock.yaml after a successful npm publish."
fi