From 48080b67c5c5c639683719b52630bbcbcfc3f445 Mon Sep 17 00:00:00 2001 From: Walter Cheng Date: Fri, 17 Jul 2026 21:58:17 -0400 Subject: [PATCH 1/2] feat: add reusable agent marketplace release workflow --- .../workflows/agent-marketplace-release.yaml | 183 ++++++------------ 1 file changed, 64 insertions(+), 119 deletions(-) diff --git a/.github/workflows/agent-marketplace-release.yaml b/.github/workflows/agent-marketplace-release.yaml index 5901983..23bce83 100644 --- a/.github/workflows/agent-marketplace-release.yaml +++ b/.github/workflows/agent-marketplace-release.yaml @@ -1,79 +1,53 @@ -name: Agent marketplace release +name: Release agent marketplace on: workflow_call: inputs: - skill_root: - description: Canonical skill directory relative to the repository root. - 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. + target_branch: + description: Branch that receives release-please changes. required: false type: string + default: main release_config_file: - description: Release Please configuration file. - required: false + description: Path to the release-please configuration file. + required: true type: string - default: release-please-config.json release_manifest_file: - description: Release Please manifest file. - required: false + description: Path to the release-please manifest file. + required: true type: string - default: .release-please-manifest.json package_paths: - description: Space-separated paths to package into the release archive. - required: false + description: Space-separated paths to include in the marketplace archive. + required: true type: string - default: skills .claude-plugin .cursor-plugin .agents plugins README.md CHANGELOG.md 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 type: string - default: agent-marketplace - claude_plugin_name: - description: Claude plugin name used in the installation summary. + default: "" + gitea_user: + description: Gitea user or organization that owns the generic package. required: false type: string - default: marketplace - claude_marketplace_name: - description: Claude marketplace name used in the installation summary. + default: "" + secrets: + GITEA_TOKEN: + description: Gitea token with permission to publish generic packages. 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: contents: write pull-requests: write -concurrency: - group: release-please - cancel-in-progress: false - jobs: release-please: runs-on: ubuntu-latest @@ -86,89 +60,60 @@ jobs: id: release uses: googleapis/release-please-action@v4 with: - token: ${{ github.token }} - target-branch: ${{ github.event.repository.default_branch || 'master' }} + token: ${{ secrets.GITHUB_PAT || github.token }} + target-branch: ${{ inputs.target_branch }} config-file: ${{ inputs.release_config_file }} manifest-file: ${{ inputs.release_manifest_file }} publish: 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 permissions: - contents: write + contents: read steps: - - name: Check out released version + - name: Check out released marketplace uses: actions/checkout@v4 with: ref: ${{ needs.release-please.outputs.tag_name }} - - name: Validate released marketplace - uses: walter-base/common-workflow/actions/validate-agent-marketplace@master - 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 + + - name: Build marketplace archive env: - VERSION: ${{ needs.release-please.outputs.version }} - PACKAGE_PATHS: ${{ inputs.package_paths }} ARCHIVE_NAME: ${{ inputs.archive_name }} - shell: bash + PACKAGE_PATHS: ${{ inputs.package_paths }} + VERSION: ${{ needs.release-please.outputs.tag_name }} run: | - dir="${ARCHIVE_NAME}-${VERSION}" - mkdir -p "dist/${dir}" - for path in ${PACKAGE_PATHS}; do - cp -R "$path" "dist/${dir}/" - done - tar -czf "dist/${dir}.tar.gz" -C dist "${dir}" - - name: Write installation summary + read -r -a paths <<< "$PACKAGE_PATHS" + tar -czf "${ARCHIVE_NAME}-${VERSION}.tar.gz" "${paths[@]}" + + - name: Upload archive to Gitea env: - VERSION: ${{ needs.release-please.outputs.version }} - TAG: ${{ needs.release-please.outputs.tag_name }} - REPOSITORY: ${{ github.repository }} - SERVER_URL: ${{ github.server_url }} - SKILL_ROOT: ${{ inputs.skill_root }} - 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 }} + ARCHIVE_NAME: ${{ inputs.archive_name }} + GITEA_URL: ${{ inputs.gitea_url }} + GITEA_USER: ${{ inputs.gitea_user }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} + VERSION: ${{ needs.release-please.outputs.tag_name }} 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" < Date: Fri, 17 Jul 2026 22:01:52 -0400 Subject: [PATCH 2/2] fix: preserve existing marketplace release behavior --- .../workflows/agent-marketplace-release.yaml | 162 ++++++++++++++++-- 1 file changed, 143 insertions(+), 19 deletions(-) diff --git a/.github/workflows/agent-marketplace-release.yaml b/.github/workflows/agent-marketplace-release.yaml index 23bce83..ae7d8a9 100644 --- a/.github/workflows/agent-marketplace-release.yaml +++ b/.github/workflows/agent-marketplace-release.yaml @@ -1,4 +1,4 @@ -name: Release agent marketplace +name: Agent marketplace release on: workflow_call: @@ -8,22 +8,71 @@ on: required: false type: string default: main + skill_root: + description: Canonical skill directory relative to the repository root. + 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 + default: plugins/marketplace + cursor_plugin_root: + description: Cursor plugin root relative to the repository root. + required: false + type: string + default: plugins/marketplace release_config_file: - description: Path to the release-please configuration file. - required: true + description: Release Please configuration file. + required: false type: string + default: release-please-config.json release_manifest_file: - description: Path to the release-please manifest file. - required: true + description: Release Please manifest file. + required: false type: string + default: .release-please-manifest.json package_paths: - description: Space-separated paths to include in the marketplace archive. - required: true + description: Space-separated paths to package into the release archive. + required: false type: string + default: skills .claude-plugin .cursor-plugin .agents plugins README.md CHANGELOG.md archive_name: - description: Base name for the marketplace archive. - required: true + description: Prefix used for the release archive. + required: false type: string + default: agent-marketplace + claude_plugin_name: + description: Claude plugin name used in the installation summary. + required: false + type: string + default: marketplace + claude_marketplace_name: + description: Claude marketplace name used in the installation summary. + 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 publish_gitea: description: Upload the released archive to Gitea and write its URL to the summary. required: false @@ -40,6 +89,9 @@ on: type: string default: "" secrets: + GITHUB_PAT: + description: Optional GitHub token for release-please pull requests. + required: false GITEA_TOKEN: description: Gitea token with permission to publish generic packages. required: false @@ -48,6 +100,10 @@ permissions: contents: write pull-requests: write +concurrency: + group: release-please + cancel-in-progress: false + jobs: release-please: runs-on: ubuntu-latest @@ -67,32 +123,47 @@ jobs: publish: needs: release-please - if: inputs.publish_gitea && needs.release-please.outputs.release_created == 'true' + if: needs.release-please.outputs.release_created == 'true' runs-on: ubuntu-latest permissions: - contents: read + contents: write steps: - - name: Check out released marketplace + - name: Check out released version uses: actions/checkout@v4 with: ref: ${{ needs.release-please.outputs.tag_name }} - - name: Build marketplace archive + - name: Validate released marketplace + uses: walter-base/common-workflow/actions/validate-agent-marketplace@master + 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: - ARCHIVE_NAME: ${{ inputs.archive_name }} + VERSION: ${{ needs.release-please.outputs.version }} PACKAGE_PATHS: ${{ inputs.package_paths }} - VERSION: ${{ needs.release-please.outputs.tag_name }} + ARCHIVE_NAME: ${{ inputs.archive_name }} + shell: bash run: | - read -r -a paths <<< "$PACKAGE_PATHS" - tar -czf "${ARCHIVE_NAME}-${VERSION}.tar.gz" "${paths[@]}" + dir="${ARCHIVE_NAME}-${VERSION}" + mkdir -p "dist/${dir}" + for path in ${PACKAGE_PATHS}; do + cp -R "$path" "dist/${dir}/" + done + tar -czf "dist/${dir}.tar.gz" -C dist "${dir}" - name: Upload archive to Gitea + if: inputs.publish_gitea env: ARCHIVE_NAME: ${{ inputs.archive_name }} GITEA_URL: ${{ inputs.gitea_url }} GITEA_USER: ${{ inputs.gitea_user }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - VERSION: ${{ needs.release-please.outputs.tag_name }} + VERSION: ${{ needs.release-please.outputs.version }} run: | : "${GITEA_URL:?Set gitea_url when publish_gitea is enabled}" : "${GITEA_USER:?Set gitea_user when publish_gitea is enabled}" @@ -101,7 +172,7 @@ jobs: 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" \ + --upload-file "dist/${archive}" \ "$package_url" cat >> "$GITHUB_STEP_SUMMARY" <> "$GITHUB_STEP_SUMMARY" <