fix(plan): stabilize browser actions #191
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release toolcraft packages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "packages/toolcraft/**" | |
| - "packages/toolcraft-design/**" | |
| - "packages/toolcraft-schema/**" | |
| - "packages/toolcraft-openapi/**" | |
| - "packages/agent-defs/**" | |
| - "packages/agent-human-in-loop/**" | |
| - "packages/agent-mcp-config/**" | |
| - "packages/auth-store/**" | |
| - "packages/config-mutations/**" | |
| - "packages/frontmatter/**" | |
| - "packages/mcp-oauth/**" | |
| - "packages/mcp-oauth-server/**" | |
| - "packages/process-runner/**" | |
| - "packages/task-list/**" | |
| - "packages/tiny-http-mcp-server/**" | |
| - "packages/tiny-mcp-client/**" | |
| - "scripts/toolcraft-standalone-bundle.mjs" | |
| - "scripts/manage-bundled-workspace-deps.mjs" | |
| - "scripts/prepare-published-workspace-version.mjs" | |
| - "scripts/verify-toolcraft-cli-bundle.mjs" | |
| - "scripts/verify-toolcraft-standalone.mjs" | |
| - "scripts/verify-toolcraft-published-sdk-types.mjs" | |
| - "package.json" | |
| - "package-lock.json" | |
| - ".github/workflows/release-toolcraft.yml" | |
| concurrency: | |
| group: release-toolcraft | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| standalone-bundle: | |
| strategy: | |
| matrix: | |
| node-version: [18.18.0, 20, 22, 24] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: npm clean-install | |
| - name: Build toolcraft and bundled dependencies | |
| run: npx turbo build --filter=toolcraft | |
| - name: Verify published SDK declaration types | |
| if: matrix.node-version == 22 | |
| run: npm run smoke:toolcraft-sdk-types | |
| - name: Build and start the standalone CLI bundle | |
| run: npm run smoke:toolcraft-bundle | |
| publish: | |
| needs: standalone-bundle | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.14.0 | |
| registry-url: https://registry.npmjs.org | |
| - name: Upgrade npm for trusted publishing | |
| run: npm install --global npm@^11.5.1 | |
| - name: Install dependencies | |
| run: npm clean-install | |
| - name: Prepare released HTTP transport version | |
| id: http-version | |
| run: | | |
| VERSION=$(node scripts/prepare-published-workspace-version.mjs packages/tiny-http-mcp-server) | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Compute next version | |
| id: version | |
| run: | | |
| VERSIONS=( | |
| "$(npm view toolcraft-schema version 2>/dev/null || echo "0.0.0")" | |
| "$(npm view toolcraft version 2>/dev/null || echo "0.0.0")" | |
| "$(npm view toolcraft-openapi version 2>/dev/null || echo "0.0.0")" | |
| ) | |
| NEXT=$(node -e ' | |
| const semver = require("semver"); | |
| const versions = process.argv.slice(1); | |
| const highest = versions.sort(semver.compare).at(-1); | |
| const next = versions.every((version) => version === highest) | |
| ? semver.inc(highest, "patch") | |
| : highest; | |
| if (!next) process.exit(1); | |
| console.log(next); | |
| ' "${VERSIONS[@]}") | |
| echo "next=${NEXT}" >> "$GITHUB_OUTPUT" | |
| - name: Prepare lockstep package versions | |
| uses: ./.github/actions/prepare-lockstep-release | |
| with: | |
| version: ${{ steps.version.outputs.next }} | |
| packages: '["packages/toolcraft-schema", "packages/toolcraft", "packages/toolcraft-openapi"]' | |
| - name: Build toolcraft packages and dependencies | |
| run: npx turbo build --filter=toolcraft-design --filter=toolcraft --filter=toolcraft-openapi | |
| - name: Verify standalone install resolves all bundled imports | |
| env: | |
| EXPECTED_TINY_HTTP_MCP_SERVER_VERSION: ${{ steps.http-version.outputs.version }} | |
| run: npm run smoke:toolcraft-standalone | |
| - name: Publish toolcraft-schema | |
| working-directory: packages/toolcraft-schema | |
| run: | | |
| if npm view "toolcraft-schema@${{ steps.version.outputs.next }}" version >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| npm publish --provenance --access public | |
| - name: Wait for toolcraft-schema registry availability | |
| run: | | |
| for _ in {1..12}; do | |
| if npm view "toolcraft-schema@${{ steps.version.outputs.next }}" version >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| sleep 5 | |
| done | |
| npm view "toolcraft-schema@${{ steps.version.outputs.next }}" version | |
| - name: Verify packed Toolcraft signatures | |
| run: | | |
| PACK_DIR=$(mktemp -d) | |
| TARBALL=$(npm pack ./packages/toolcraft --pack-destination "$PACK_DIR" --json | node -e "let input=''; process.stdin.on('data', chunk => input += chunk); process.stdin.on('end', () => console.log(JSON.parse(input)[0].filename));") | |
| AUDIT_DIR=$(mktemp -d) | |
| printf '%s\n' '{"name":"toolcraft-packed-signature-audit","private":true}' > "$AUDIT_DIR/package.json" | |
| npm install --ignore-scripts --prefix "$AUDIT_DIR" "$PACK_DIR/$TARBALL" | |
| npm audit signatures --omit=optional --prefix "$AUDIT_DIR" | |
| - name: Publish toolcraft | |
| working-directory: packages/toolcraft | |
| run: | | |
| if npm view "toolcraft@${{ steps.version.outputs.next }}" version >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| npm publish --provenance --access public | |
| - name: Publish toolcraft-openapi | |
| working-directory: packages/toolcraft-openapi | |
| run: | | |
| if npm view "toolcraft-openapi@${{ steps.version.outputs.next }}" version >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| npm publish --provenance --access public | |
| - name: Wait for Toolcraft registry availability | |
| run: | | |
| for _ in {1..12}; do | |
| if npm view "toolcraft@${{ steps.version.outputs.next }}" version >/dev/null 2>&1 \ | |
| && npm view "toolcraft-openapi@${{ steps.version.outputs.next }}" version >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| sleep 5 | |
| done | |
| npm view "toolcraft@${{ steps.version.outputs.next }}" version | |
| npm view "toolcraft-openapi@${{ steps.version.outputs.next }}" version | |
| - name: Verify installed Toolcraft signatures | |
| run: | | |
| AUDIT_DIR=$(mktemp -d) | |
| printf '%s\n' '{"name":"toolcraft-signature-audit","private":true}' > "$AUDIT_DIR/package.json" | |
| cd "$AUDIT_DIR" | |
| npm install "toolcraft@${{ steps.version.outputs.next }}" | |
| npm audit signatures --omit=optional |