From cc95e92450f62158dba4031c3cbb96deafe93096 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Tue, 16 Dec 2025 14:33:40 +0000 Subject: [PATCH] ... another attempt with goreleaser publishing. --- .gitignore | 1 + .goreleaser.yaml | 11 ++++---- scripts/generate-plugin-config.sh | 44 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100755 scripts/generate-plugin-config.sh diff --git a/.gitignore b/.gitignore index 2dbd0d6..22c5665 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,4 @@ logs/ # goreleaser dist/ docs/dist +.claude-plugin diff --git a/.goreleaser.yaml b/.goreleaser.yaml index dfa2b98..4cf7928 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -14,9 +14,8 @@ before: - bash -c "sed 's/{{ .Version }}/{{ .Version }}/g' ui/package.json.tpl > ui/package.json" - bash -c "cd ui && npm ci --silent && npm run build" - bash -c "rm -rf internal/worker/static && mkdir -p internal/worker/static && cp -r ui/dist/* internal/worker/static/" - # Generate plugin config files (must be before archives, using GORELEASER_CURRENT_TAG) - - bash -c "mkdir -p .claude-plugin && VERSION=${GORELEASER_CURRENT_TAG#v} && sed \"s/{{.Version}}/$VERSION/g; s/{{ .Version }}/$VERSION/g\" plugin/.claude-plugin/plugin.json.tpl > .claude-plugin/plugin.json" - - bash -c "VERSION=${GORELEASER_CURRENT_TAG#v} && sed \"s/{{.Version}}/$VERSION/g; s/{{ .Version }}/$VERSION/g\" plugin/.claude-plugin/marketplace.json.tpl > .claude-plugin/marketplace.json" + # Generate plugin config files for archives (in .claude-plugin/) + - bash scripts/generate-plugin-config.sh builds: # Worker service @@ -263,10 +262,10 @@ release: draft: false prerelease: auto name_template: "v{{.Version}}" - # Upload plugin config files + # Upload plugin config files (from linux build artifacts in split mode) extra_files: - - glob: .claude-plugin/plugin.json - - glob: .claude-plugin/marketplace.json + - glob: dist/linux/.claude-plugin/plugin.json + - glob: dist/linux/.claude-plugin/marketplace.json header: | ## Claude Mnemonic v{{.Version}} diff --git a/scripts/generate-plugin-config.sh b/scripts/generate-plugin-config.sh new file mode 100755 index 0000000..56fa77c --- /dev/null +++ b/scripts/generate-plugin-config.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Generate plugin configuration files with version substitution +# Called from .goreleaser.yaml before hooks + +set -e + +# Get version from GoReleaser environment variable +if [ -n "$GORELEASER_CURRENT_TAG" ]; then + VERSION="${GORELEASER_CURRENT_TAG#v}" + echo "Using version from GORELEASER_CURRENT_TAG: $VERSION" +else + # Fallback for local testing + VERSION="0.0.0-dev" + echo "GORELEASER_CURRENT_TAG not set, using fallback version: $VERSION" +fi + +# Source and destination directories +TEMPLATE_DIR="plugin/.claude-plugin" +OUTPUT_DIR=".claude-plugin" + +# Create output directory +mkdir -p "$OUTPUT_DIR" + +# Generate plugin.json +if [ -f "$TEMPLATE_DIR/plugin.json.tpl" ]; then + sed "s/{{ .Version }}/$VERSION/g; s/{{.Version}}/$VERSION/g" \ + "$TEMPLATE_DIR/plugin.json.tpl" > "$OUTPUT_DIR/plugin.json" + echo "Generated $OUTPUT_DIR/plugin.json" +else + echo "ERROR: Template file not found: $TEMPLATE_DIR/plugin.json.tpl" + exit 1 +fi + +# Generate marketplace.json +if [ -f "$TEMPLATE_DIR/marketplace.json.tpl" ]; then + sed "s/{{ .Version }}/$VERSION/g; s/{{.Version}}/$VERSION/g" \ + "$TEMPLATE_DIR/marketplace.json.tpl" > "$OUTPUT_DIR/marketplace.json" + echo "Generated $OUTPUT_DIR/marketplace.json" +else + echo "ERROR: Template file not found: $TEMPLATE_DIR/marketplace.json.tpl" + exit 1 +fi + +echo "Plugin config files generated successfully with version $VERSION"