1- name : Release
1+ name : Package plugins
22
33on :
44 push :
55 tags : ['v*']
66 workflow_dispatch :
77 inputs :
88 tag :
9- description : ' Existing release tag to build (for example v0.1 .1)'
10- required : true
9+ description : ' Optional existing tag (e.g. v0.3 .1). Leave blank to package the selected branch without publishing a release. '
10+ required : false
1111 type : string
1212
1313permissions :
@@ -18,86 +18,42 @@ concurrency:
1818 cancel-in-progress : false
1919
2020jobs :
21- # Windows binaries are cross-compiled on Linux, so prove one actually installs
22- # and runs under Git Bash before anything is published.
23- smoke-windows :
24- runs-on : windows-latest
25- defaults :
26- run :
27- shell : bash
28- env :
29- RELEASE_TAG : ${{ inputs.tag || github.ref_name }}
30- steps :
31- - name : Validate release tag
32- run : |
33- [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
34- echo "Expected an existing version tag such as v0.1.1" >&2
35- exit 1
36- }
37- - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
38- with :
39- ref : refs/tags/${{ env.RELEASE_TAG }}
40- - uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
41- with :
42- go-version-file : go.mod
43- - name : Build the Windows asset
44- run : |
45- GITHUB_REF_NAME="$RELEASE_TAG" PLASMA_RELEASE_TARGETS=windows/amd64 \
46- bash scripts/build-release.sh
47- - name : Smoke test packaged Windows binary
48- run : |
49- # MSYS-style paths only; RUNNER_TEMP is a backslash Windows path.
50- export PLASMA_PLUGIN_HOME="$(mktemp -d)/plasma-release-smoke"
51- export PLASMA_MCP_RELEASE_DIR="$(pwd)/dist/$RELEASE_TAG"
52- test -f "$PLASMA_MCP_RELEASE_DIR/plasma-plugin-mcp_${RELEASE_TAG#v}_windows_amd64.tar.gz"
53- printf '%s' '{"hook_event_name":"PreToolUse","tool_name":"mcp__plasma__sync_view"}' |
54- bash bin/plasma-mcp.sh hook > hook.json
55- grep -q '"permissionDecision":"ask"' hook.json
56- test -x "$PLASMA_PLUGIN_HOME/bin/$RELEASE_TAG/windows-amd64/plasma-plugin-mcp.exe"
57-
5821 release :
59- needs : smoke-windows
6022 runs-on : ubuntu-latest
6123 env :
62- RELEASE_TAG : ${{ inputs.tag || github.ref_name }}
24+ RELEASE_TAG : ${{ inputs.tag || ( github.ref_type == 'tag' && github. ref_name) || '' }}
6325 permissions :
6426 contents : write
6527 steps :
6628 - name : Validate release tag
6729 run : |
68- [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
69- echo "Expected an existing version tag such as v0.1.1" >&2
70- exit 1
71- }
30+ if [[ -n "$RELEASE_TAG" ]]; then
31+ [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1
32+ fi
7233 - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
7334 with :
74- # Manual runs use the workflow on main but build the exact tagged source.
75- ref : refs/tags/${{ env.RELEASE_TAG }}
76- - uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
77- with :
78- go-version-file : go.mod
79- - name : Verify version and source
80- run : |
81- python3 - <<'PY'
82- import json, os, pathlib
83- version = pathlib.Path('VERSION').read_text().strip()
84- assert os.environ['RELEASE_TAG'] == 'v' + version
85- assert json.loads(pathlib.Path('.claude-plugin/plugin.json').read_text())['version'] == version
86- PY
87- test -z "$(gofmt -l cmd internal)"
88- go vet ./...
89- go test ./...
90- make test-launcher
91- - name : Build release assets
35+ ref : ${{ env.RELEASE_TAG != '' && format('refs/tags/{0}', env.RELEASE_TAG) || github.ref }}
36+ - name : Check plugin packages
37+ run : make check
38+ - name : Package ChatGPT and Claude plugins
9239 run : GITHUB_REF_NAME="$RELEASE_TAG" make release
93- - name : Smoke test packaged Linux binary
40+ - name : Read package version
41+ id : package
9442 run : |
95- export PLASMA_PLUGIN_HOME="$RUNNER_TEMP/plasma-release-smoke"
96- export PLASMA_MCP_RELEASE_DIR="$GITHUB_WORKSPACE/dist/$RELEASE_TAG"
97- printf '%s' '{"hook_event_name":"PreToolUse","tool_name":"mcp__plasma__sync_view"}' |
98- bash bin/plasma-mcp.sh hook > "$RUNNER_TEMP/hook.json"
99- python3 -c 'import json,sys; assert json.load(open(sys.argv[1]))["hookSpecificOutput"]["permissionDecision"] == "ask"' "$RUNNER_TEMP/hook.json"
43+ version="$(cat VERSION)"
44+ [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit 1
45+ echo "version=$version" >> "$GITHUB_OUTPUT"
46+ - name : Upload installation packages
47+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
48+ with :
49+ name : plasma-plugin-${{ steps.package.outputs.version }}
50+ path : |
51+ dist/v${{ steps.package.outputs.version }}/*.zip
52+ dist/v${{ steps.package.outputs.version }}/checksums.txt
53+ if-no-files-found : error
54+ retention-days : 30
10055 - name : Publish release
56+ if : env.RELEASE_TAG != ''
10157 env :
10258 GH_TOKEN : ${{ github.token }}
10359 GH_REPO : ${{ github.repository }}
0 commit comments