Agent Release Package #17
Workflow file for this run
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: Agent Release Package | |
| on: | |
| release: | |
| types: [released] | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: Existing stable release tag to attach the agent zip to (e.g. v1.2.3) | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| package-agent-variant: | |
| name: Package Agent Variant | |
| runs-on: ubuntu-latest | |
| env: | |
| PLUGIN_SLUG: debug-bar-console | |
| steps: | |
| - name: Resolve source tag | |
| id: meta | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| source_tag="${{ github.event.release.tag_name }}" | |
| else | |
| source_tag="${{ inputs.release_tag }}" | |
| fi | |
| if [[ -z "${source_tag}" ]]; then | |
| echo "Unable to determine source tag." >&2 | |
| exit 1 | |
| fi | |
| agent_zip="${PLUGIN_SLUG}-${source_tag}-agent.zip" | |
| stable_zip="${PLUGIN_SLUG}-${source_tag}-stable-check.zip" | |
| echo "source_tag=${source_tag}" >> "${GITHUB_OUTPUT}" | |
| echo "agent_zip=${agent_zip}" >> "${GITHUB_OUTPUT}" | |
| echo "stable_zip=${stable_zip}" >> "${GITHUB_OUTPUT}" | |
| - name: Checkout source tag | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ steps.meta.outputs.source_tag }} | |
| - name: Build stable package check archive | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist | |
| git archive \ | |
| --worktree-attributes \ | |
| --format=zip \ | |
| --output="dist/${{ steps.meta.outputs.stable_zip }}" \ | |
| "${{ steps.meta.outputs.source_tag }}" | |
| - name: Validate stable archive exclusions | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| archive_path="dist/${{ steps.meta.outputs.stable_zip }}" | |
| archive_files="$(unzip -Z1 "${archive_path}")" | |
| # Stable package must never ship agent docs or dev metadata. | |
| disallowed_pattern='^\.agent/.+$|^AGENTS\.md$|^CLAUDE\.md$|^tests/|^\.github/|^\.claude/|^phpstan\.neon$|^phpunit\.xml$|^pint\.json$' | |
| if echo "${archive_files}" | grep -E "${disallowed_pattern}" >/dev/null; then | |
| echo "Stable archive contains disallowed files." >&2 | |
| echo "${archive_files}" | grep -E "${disallowed_pattern}" >&2 || true | |
| exit 1 | |
| fi | |
| - name: Build agent variant archive | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| archive_attributes=".git/info/attributes" | |
| # Add agent-variant overrides for git archive matching. | |
| { | |
| echo "" | |
| echo "# Agent variant overrides" | |
| cat .agent/.gitattributes.agent | |
| } >> "${archive_attributes}" | |
| git archive \ | |
| --worktree-attributes \ | |
| --format=zip \ | |
| --prefix=debug-bar-console/ \ | |
| --output="dist/${{ steps.meta.outputs.agent_zip }}" \ | |
| "${{ steps.meta.outputs.source_tag }}" | |
| - name: Validate agent archive content | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| archive_path="dist/${{ steps.meta.outputs.agent_zip }}" | |
| archive_files="$(unzip -Z1 "${archive_path}")" | |
| required_paths=( | |
| "debug-bar-console/.agent/README.md" | |
| "debug-bar-console/AGENTS.md" | |
| "debug-bar-console/CLAUDE.md" | |
| ) | |
| for required_path in "${required_paths[@]}"; do | |
| if ! echo "${archive_files}" | grep -E "^${required_path}$" >/dev/null; then | |
| echo "Agent archive missing required file: ${required_path}" >&2 | |
| exit 1 | |
| fi | |
| done | |
| disallowed_pattern='^debug-bar-console/tests/|^debug-bar-console/\.github/|^debug-bar-console/\.claude/|^debug-bar-console/phpstan\.neon$|^debug-bar-console/phpunit\.xml$|^debug-bar-console/pint\.json$' | |
| if echo "${archive_files}" | grep -E "${disallowed_pattern}" >/dev/null; then | |
| echo "Agent archive contains disallowed files." >&2 | |
| echo "${archive_files}" | grep -E "${disallowed_pattern}" >&2 || true | |
| exit 1 | |
| fi | |
| - name: Append agent note to stable release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| existing_body="$(gh release view "${{ steps.meta.outputs.source_tag }}" --json body --jq '.body // ""')" | |
| cat > dist/updated-release-notes.md << EOF | |
| ${existing_body} | |
| --- | |
| \`${{ steps.meta.outputs.agent_zip }}\` includes the following agent files not present in the stable release: | |
| - \`AGENTS.md\` | |
| - \`CLAUDE.md\` | |
| - \`.agent/\` directory | |
| EOF | |
| gh release edit "${{ steps.meta.outputs.source_tag }}" \ | |
| --notes-file dist/updated-release-notes.md | |
| - name: Attach agent zip to stable release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| gh release upload "${{ steps.meta.outputs.source_tag }}" \ | |
| "dist/${{ steps.meta.outputs.agent_zip }}" \ | |
| --clobber |