mirror of
https://github.com/walter-base/common-workflow.git
synced 2026-09-08 19:26:46 -04:00
feat: add reusable agent marketplace release workflow
This commit is contained in:
@@ -1,79 +1,53 @@
|
|||||||
name: Agent marketplace release
|
name: Release agent marketplace
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
skill_root:
|
target_branch:
|
||||||
description: Canonical skill directory relative to the repository root.
|
description: Branch that receives release-please changes.
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: skills
|
|
||||||
claude_marketplace_file:
|
|
||||||
description: Claude marketplace manifest relative to the repository root.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: .claude-plugin/marketplace.json
|
|
||||||
claude_plugin_file:
|
|
||||||
description: Claude plugin manifest relative to the repository root.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: .claude-plugin/plugin.json
|
|
||||||
codex_plugin_root:
|
|
||||||
description: Codex plugin root relative to the repository root.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
cursor_plugin_root:
|
|
||||||
description: Cursor plugin root relative to the repository root.
|
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
default: main
|
||||||
release_config_file:
|
release_config_file:
|
||||||
description: Release Please configuration file.
|
description: Path to the release-please configuration file.
|
||||||
required: false
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: release-please-config.json
|
|
||||||
release_manifest_file:
|
release_manifest_file:
|
||||||
description: Release Please manifest file.
|
description: Path to the release-please manifest file.
|
||||||
required: false
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: .release-please-manifest.json
|
|
||||||
package_paths:
|
package_paths:
|
||||||
description: Space-separated paths to package into the release archive.
|
description: Space-separated paths to include in the marketplace archive.
|
||||||
required: false
|
required: true
|
||||||
type: string
|
type: string
|
||||||
default: skills .claude-plugin .cursor-plugin .agents plugins README.md CHANGELOG.md
|
|
||||||
archive_name:
|
archive_name:
|
||||||
description: Prefix used for the release archive.
|
description: Base name for the marketplace archive.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
publish_gitea:
|
||||||
|
description: Upload the released archive to Gitea and write its URL to the summary.
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
gitea_url:
|
||||||
|
description: Base URL of the Gitea instance.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: agent-marketplace
|
default: ""
|
||||||
claude_plugin_name:
|
gitea_user:
|
||||||
description: Claude plugin name used in the installation summary.
|
description: Gitea user or organization that owns the generic package.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: marketplace
|
default: ""
|
||||||
claude_marketplace_name:
|
secrets:
|
||||||
description: Claude marketplace name used in the installation summary.
|
GITEA_TOKEN:
|
||||||
|
description: Gitea token with permission to publish generic packages.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
|
||||||
default: marketplace
|
|
||||||
codex_marketplace_name:
|
|
||||||
description: Codex marketplace name shown in the installation summary.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: marketplace
|
|
||||||
cursor_plugin_name:
|
|
||||||
description: Cursor plugin name shown in the installation summary.
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: marketplace
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: release-please
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-please:
|
release-please:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -86,89 +60,60 @@ jobs:
|
|||||||
id: release
|
id: release
|
||||||
uses: googleapis/release-please-action@v4
|
uses: googleapis/release-please-action@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ github.token }}
|
token: ${{ secrets.GITHUB_PAT || github.token }}
|
||||||
target-branch: ${{ github.event.repository.default_branch || 'master' }}
|
target-branch: ${{ inputs.target_branch }}
|
||||||
config-file: ${{ inputs.release_config_file }}
|
config-file: ${{ inputs.release_config_file }}
|
||||||
manifest-file: ${{ inputs.release_manifest_file }}
|
manifest-file: ${{ inputs.release_manifest_file }}
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: release-please
|
needs: release-please
|
||||||
if: needs.release-please.outputs.release_created == 'true'
|
if: inputs.publish_gitea && needs.release-please.outputs.release_created == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Check out released version
|
- name: Check out released marketplace
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.release-please.outputs.tag_name }}
|
ref: ${{ needs.release-please.outputs.tag_name }}
|
||||||
- name: Validate released marketplace
|
|
||||||
uses: walter-base/common-workflow/actions/validate-agent-marketplace@master
|
- name: Build marketplace archive
|
||||||
with:
|
|
||||||
skill_root: ${{ inputs.skill_root }}
|
|
||||||
claude_marketplace_file: ${{ inputs.claude_marketplace_file }}
|
|
||||||
claude_plugin_file: ${{ inputs.claude_plugin_file }}
|
|
||||||
codex_plugin_root: ${{ inputs.codex_plugin_root }}
|
|
||||||
cursor_plugin_root: ${{ inputs.cursor_plugin_root }}
|
|
||||||
- name: Build release archive
|
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ needs.release-please.outputs.version }}
|
|
||||||
PACKAGE_PATHS: ${{ inputs.package_paths }}
|
|
||||||
ARCHIVE_NAME: ${{ inputs.archive_name }}
|
ARCHIVE_NAME: ${{ inputs.archive_name }}
|
||||||
shell: bash
|
PACKAGE_PATHS: ${{ inputs.package_paths }}
|
||||||
|
VERSION: ${{ needs.release-please.outputs.tag_name }}
|
||||||
run: |
|
run: |
|
||||||
dir="${ARCHIVE_NAME}-${VERSION}"
|
read -r -a paths <<< "$PACKAGE_PATHS"
|
||||||
mkdir -p "dist/${dir}"
|
tar -czf "${ARCHIVE_NAME}-${VERSION}.tar.gz" "${paths[@]}"
|
||||||
for path in ${PACKAGE_PATHS}; do
|
|
||||||
cp -R "$path" "dist/${dir}/"
|
- name: Upload archive to Gitea
|
||||||
done
|
|
||||||
tar -czf "dist/${dir}.tar.gz" -C dist "${dir}"
|
|
||||||
- name: Write installation summary
|
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ needs.release-please.outputs.version }}
|
ARCHIVE_NAME: ${{ inputs.archive_name }}
|
||||||
TAG: ${{ needs.release-please.outputs.tag_name }}
|
GITEA_URL: ${{ inputs.gitea_url }}
|
||||||
REPOSITORY: ${{ github.repository }}
|
GITEA_USER: ${{ inputs.gitea_user }}
|
||||||
SERVER_URL: ${{ github.server_url }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
SKILL_ROOT: ${{ inputs.skill_root }}
|
VERSION: ${{ needs.release-please.outputs.tag_name }}
|
||||||
CLAUDE_PLUGIN_NAME: ${{ inputs.claude_plugin_name }}
|
|
||||||
CLAUDE_MARKETPLACE_NAME: ${{ inputs.claude_marketplace_name }}
|
|
||||||
CODEX_MARKETPLACE_NAME: ${{ inputs.codex_marketplace_name }}
|
|
||||||
CURSOR_PLUGIN_NAME: ${{ inputs.cursor_plugin_name }}
|
|
||||||
run: |
|
run: |
|
||||||
|
: "${GITEA_URL:?Set gitea_url when publish_gitea is enabled}"
|
||||||
|
: "${GITEA_USER:?Set gitea_user when publish_gitea is enabled}"
|
||||||
|
: "${GITEA_TOKEN:?Pass GITEA_TOKEN when publish_gitea is enabled}"
|
||||||
|
archive="${ARCHIVE_NAME}-${VERSION}.tar.gz"
|
||||||
|
package_url="${GITEA_URL%/}/api/packages/${GITEA_USER}/generic/${ARCHIVE_NAME}/${VERSION}/${archive}"
|
||||||
|
curl --fail-with-body --retry 3 \
|
||||||
|
--user "${GITEA_USER}:${GITEA_TOKEN}" \
|
||||||
|
--upload-file "$archive" \
|
||||||
|
"$package_url"
|
||||||
|
|
||||||
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
|
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
|
||||||
# Agent marketplace ${VERSION}
|
# Agent Marketplace ${VERSION}
|
||||||
|
|
||||||
Release tag: \`${TAG}\`
|
Download the marketplace archive from Gitea:
|
||||||
|
|
||||||
## Claude Code
|
${package_url}
|
||||||
|
|
||||||
\`\`\`bash
|
```bash
|
||||||
claude plugin marketplace add ${REPOSITORY}@${TAG}
|
curl --user "GITEA_USER:GITEA_TOKEN" \\
|
||||||
claude plugin install ${CLAUDE_PLUGIN_NAME}@${CLAUDE_MARKETPLACE_NAME}
|
--output "${archive}" \\
|
||||||
\`\`\`
|
"${package_url}"
|
||||||
|
```
|
||||||
## Codex
|
|
||||||
|
|
||||||
\`\`\`bash
|
|
||||||
codex plugin marketplace add ${REPOSITORY} --ref ${TAG}
|
|
||||||
codex
|
|
||||||
# In Codex, run: /plugins and install ${CODEX_MARKETPLACE_NAME}.
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
## OpenCode
|
|
||||||
|
|
||||||
\`\`\`bash
|
|
||||||
npx skills add ${SERVER_URL}/${REPOSITORY}/tree/${TAG}/${SKILL_ROOT} --agent opencode --skill '*'
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
## Cursor
|
|
||||||
|
|
||||||
\`\`\`bash
|
|
||||||
npx skills add ${SERVER_URL}/${REPOSITORY}/tree/${TAG}/${SKILL_ROOT} --agent cursor --skill '*'
|
|
||||||
\`\`\`
|
|
||||||
EOF
|
EOF
|
||||||
- name: Upload archive to GitHub Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: ${{ needs.release-please.outputs.tag_name }}
|
|
||||||
files: dist/${{ inputs.archive_name }}-*.tar.gz
|
|
||||||
|
|||||||
Reference in New Issue
Block a user