← Files Pics.ioARCHIVED FILE
.github/workflows/release-plugin-zip.yml
9.44 KB · Nov 30, 2026 · 07:34 UTC
name: Release plugin ZIP
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Optional bare semver tag; leave blank to create the next patch tag on master
required: false
type: string
plugin_name:
description: Package name for plugin.json; use an assigned app ID only when updating an existing plugin
required: false
default: picsio
type: string
mcp_url:
description: MCP server URL to package
required: false
default: https://mcp.pics.io/mcp
type: string
permissions:
contents: write
concurrency:
group: release-plugin-zip
cancel-in-progress: false
jobs:
package:
name: Build and attach plugin ZIP
runs-on: ubuntu-latest
timeout-minutes: 5
env:
REQUESTED_TAG: ${{ github.event.release.tag_name || inputs.tag }}
PACKAGE_PLUGIN_NAME: ${{ inputs.plugin_name || 'picsio' }}
PACKAGE_MCP_URL: ${{ inputs.mcp_url || 'https://mcp.pics.io/mcp' }}
steps:
- name: Check out release source
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && 'master' || github.event.release.tag_name }}
fetch-depth: 0
- name: Resolve tag and ensure GitHub release exists
id: release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
tag="${REQUESTED_TAG:-}"
if [[ -z "$tag" ]]; then
latest_version="$({
git tag --list | sed -nE 's/^v?([0-9]+\.[0-9]+\.[0-9]+)$/\1/p'
jq -r '.version' plugin.json
} | sort -V | tail -n 1)"
if [[ ! "$latest_version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "::error::Could not determine the latest semantic version"
exit 1
fi
tag="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.$((BASH_REMATCH[3] + 1))"
fi
if [[ ! "$tag" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Release tag $tag must be a bare semantic version such as 1.0.1"
exit 1
fi
if ! git rev-parse --verify --quiet "refs/tags/$tag" >/dev/null; then
master_sha="$(git rev-parse HEAD)"
git tag "$tag" "$master_sha"
git push origin "refs/tags/$tag"
echo "Created tag $tag on master at $master_sha"
else
echo "Using existing tag $tag"
fi
if ! gh release view "$tag" >/dev/null 2>&1; then
gh release create "$tag" \
--verify-tag \
--title "$tag" \
--generate-notes
echo "Created GitHub release $tag"
else
echo "Using existing GitHub release $tag"
fi
echo "RELEASE_TAG=$tag" >> "$GITHUB_ENV"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '26'
- name: Set release version and validate plugin files
shell: bash
run: |
set -euo pipefail
version="$RELEASE_TAG"
package_plugin_name="$PACKAGE_PLUGIN_NAME"
mcp_url="$PACKAGE_MCP_URL"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Release tag $version must be a bare semantic version such as 1.0.1"
exit 1
fi
if (( ${#package_plugin_name} > 64 )) || \
[[ ! "$package_plugin_name" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
echo "::error::Plugin name must use lowercase letters, numbers, and single hyphens"
exit 1
fi
if ! MCP_URL_TO_VALIDATE="$mcp_url" node -e '
const url = new URL(process.env.MCP_URL_TO_VALIDATE);
if (url.protocol !== "https:" || url.username || url.password || url.hash) process.exit(1);
'; then
echo "::error::MCP URL must be an HTTPS URL without credentials or a fragment"
exit 1
fi
update_manifest() {
local file="$1"
local filter="$2"
local temporary="${file}.tmp"
jq \
--arg version "$version" \
--arg plugin_name "$package_plugin_name" \
--arg mcp_url "$mcp_url" \
"$filter" "$file" > "$temporary"
mv "$temporary" "$file"
}
update_manifest plugin.json '.name = $plugin_name | .version = $version'
update_manifest .claude-plugin/plugin.json '.version = $version'
update_manifest .claude-plugin/marketplace.json \
'.metadata.version = $version | .plugins[0].version = $version'
update_manifest .codex-plugin/plugin.json '.version = $version'
update_manifest .mcp.json '.mcpServers.picsio.url = $mcp_url'
update_manifest .cursor-plugin/plugin.json \
'.version = $version | .mcpServers.picsio.url = $mcp_url'
update_manifest gemini-extension.json \
'.version = $version | .mcpServers.picsio.httpUrl = $mcp_url'
update_manifest mcp-manifest.json '.version = $version'
update_manifest server.json \
'.version = $version | .remotes[0].url = $mcp_url'
# Backfill releases tagged before the portable MCP manifest was added.
if [[ ! -f mcp.json ]]; then
jq '{
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"mcpServers": {
"picsio": {
"type": "streamable-http",
"url": .mcpServers.picsio.url
}
}
}' .mcp.json > mcp.json
else
update_manifest mcp.json '.mcpServers.picsio.url = $mcp_url'
fi
MCP_URL="$mcp_url" OPENAI_PLUGIN_NAME="$package_plugin_name" node scripts/validate.mjs
if jq -e '
.. | objects | to_entries[]? |
select(
.key | ascii_downcase |
test("^(client_?id|client_?secret|access_?token|authorization|headers)$")
)
' .mcp.json mcp.json >/dev/null; then
echo "::error::MCP configuration must not contain client credentials, tokens, authorization headers, or static headers"
exit 1
fi
if jq -e '.mcpServers.picsio.extensions["com.openai"].auth? != null' mcp.json >/dev/null; then
echo "::error::mcp.json must omit auth and reuse the existing OpenAI app connection"
exit 1
fi
- name: Build and verify ZIP
id: package
shell: bash
run: |
set -euo pipefail
version="$(jq -r '.version' plugin.json)"
zip_name="${PACKAGE_PLUGIN_NAME}-codex-plugin-${version}.zip"
zip_path="dist/${zip_name}"
mkdir -p dist
git add -- \
plugin.json \
.mcp.json \
.claude-plugin/plugin.json \
.claude-plugin/marketplace.json \
.codex-plugin/plugin.json \
.cursor-plugin/plugin.json \
gemini-extension.json \
mcp.json \
mcp-manifest.json \
server.json
release_tree="$(git write-tree)"
git archive --format=zip --output="$zip_path" "$release_tree"
unzip -t "$zip_path"
entries="$(unzip -Z1 "$zip_path")"
for required in \
plugin.json \
.mcp.json \
mcp.json \
.codex-plugin/plugin.json \
assets/logo.png \
skills/picsio-asset-search/SKILL.md \
skills/picsio-help-docs/SKILL.md; do
if ! grep -Fxq "$required" <<<"$entries"; then
echo "::error::Release ZIP is missing $required at the archive root"
exit 1
fi
done
if grep -Eq '(^|/)(\.git|\.DS_Store)(/|$)|(^|/)\.claude/settings\.local\.json$|\.zip$' <<<"$entries"; then
echo "::error::Release ZIP contains a local-only or nested ZIP file"
exit 1
fi
for mcp_config in .mcp.json mcp.json; do
if unzip -p "$zip_path" "$mcp_config" | jq -e '
.. | objects | to_entries[]? |
select(
.key | ascii_downcase |
test("^(client_?id|client_?secret|access_?token|authorization|headers)$")
)
' >/dev/null; then
echo "::error::Packaged $mcp_config contains forbidden credential configuration"
exit 1
fi
done
if unzip -p "$zip_path" mcp.json | \
jq -e '.mcpServers.picsio.extensions["com.openai"].auth? != null' >/dev/null; then
echo "::error::Packaged mcp.json must omit the existing app's auth configuration"
exit 1
fi
packaged_plugin_name="$(unzip -p "$zip_path" plugin.json | jq -r '.name')"
if [[ "$packaged_plugin_name" != "$PACKAGE_PLUGIN_NAME" ]]; then
echo "::error::Packaged plugin name $packaged_plugin_name does not match $PACKAGE_PLUGIN_NAME"
exit 1
fi
echo "zip_name=$zip_name" >> "$GITHUB_OUTPUT"
echo "zip_path=$zip_path" >> "$GITHUB_OUTPUT"
- name: Attach ZIP to GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload \
"$RELEASE_TAG" \
"${{ steps.package.outputs.zip_path }}" \
--clobber
SHA-256: 99ea6f955a42dadc0e01385668f2c13ffe79b83da76ae302f8cdbc8783d3f730