Skip to content

Merge pull request #546 from TencentCloudBase/automation/attribution-… #60

Merge pull request #546 from TencentCloudBase/automation/attribution-…

Merge pull request #546 from TencentCloudBase/automation/attribution-… #60

name: Publish ClawHub Registry
on:
push:
branches:
- main
paths:
- 'config/source/skills/**'
- 'config/source/guideline/**'
- 'scripts/build-allinone-skill.ts'
- 'scripts/build-clawhub-publish-artifacts.mjs'
- 'scripts/clawhub-publish-targets.mjs'
- 'scripts/publish-to-clawhub.mjs'
- '.github/workflows/publish-clawhub-registry.yml'
workflow_dispatch:
inputs:
targets:
description: 'Comma-separated publish targets: miniprogram-development, all-in-one, ui-design, web-development, spec-workflow'
required: true
type: string
bump:
description: 'Version bump type used by clawhub sync: patch, minor, or major'
required: false
default: 'minor'
type: choice
options:
- patch
- minor
- major
changelog:
description: 'Optional changelog text. If empty, recent commits are appended automatically.'
required: false
default: ''
type: string
tags:
description: 'Comma-separated tags passed to clawhub publish'
required: false
default: 'latest'
type: string
dry_run:
description: 'Build and validate only, skip registry publish'
required: false
default: true
type: boolean
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
env:
TARGETS: ${{ github.event_name == 'workflow_dispatch' && inputs.targets || 'miniprogram-development,all-in-one,ui-design,web-development,spec-workflow' }}
BUMP: ${{ github.event_name == 'workflow_dispatch' && inputs.bump || 'minor' }}
CHANGELOG: ${{ github.event_name == 'workflow_dispatch' && inputs.changelog || '' }}
TAGS: ${{ github.event_name == 'workflow_dispatch' && inputs.tags || 'latest' }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'false' }}
steps:
- name: Checkout toolkit repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Build publish artifacts
run: node scripts/build-clawhub-publish-artifacts.mjs --targets "$TARGETS"
- name: Install ClawHub CLI
if: ${{ !inputs.dry_run }}
run: npm install -g clawhub
- name: Login to ClawHub
if: ${{ !inputs.dry_run }}
env:
CLAWDHUB_TOKEN: ${{ secrets.CLAWDHUB_TOKEN }}
run: clawhub login --token "$CLAWDHUB_TOKEN" --no-browser
- name: Publish selected targets to ClawHub
env:
CLAWDHUB_TOKEN: ${{ secrets.CLAWDHUB_TOKEN }}
run: |
if [ "$DRY_RUN" = "true" ]; then
node scripts/publish-to-clawhub.mjs --manifest .clawhub-publish-output/manifest.json --bump "$BUMP" --changelog "$CHANGELOG" --tags "$TAGS" --dry-run
else
node scripts/publish-to-clawhub.mjs --manifest .clawhub-publish-output/manifest.json --bump "$BUMP" --changelog "$CHANGELOG" --tags "$TAGS"
fi
- name: Append job summary
run: |
echo "## ClawHub Publish Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- Targets: $TARGETS" >> "$GITHUB_STEP_SUMMARY"
echo "- Bump: $BUMP" >> "$GITHUB_STEP_SUMMARY"
echo "- Tags: $TAGS" >> "$GITHUB_STEP_SUMMARY"
echo "- Dry run: $DRY_RUN" >> "$GITHUB_STEP_SUMMARY"
echo "- Manifest: .clawhub-publish-output/manifest.json" >> "$GITHUB_STEP_SUMMARY"