From d4bf6c8c011a2563680ae0f5052cadeeac5776c9 Mon Sep 17 00:00:00 2001 From: Zhiqiang ZHOU Date: Sat, 29 Nov 2025 18:21:29 -0800 Subject: [PATCH 1/2] ci: add Homebrew cask auto-update to release workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add script to automatically update the Homebrew cask after releasing new versions, integrated into the build-and-release.sh workflow. Also configure Claude Code permissions for GitHub API access. Changes: - Add update-homebrew.sh script to automate cask updates - Integrate Homebrew update into build-and-release.sh - Upgrade Wails from v2.10.2 to v2.11.0 - Add Claude Code permissions for GitHub CLI and API access 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .claude/settings.local.json | 13 +++++ frontend/wailsjs/runtime/package.json | 0 frontend/wailsjs/runtime/runtime.d.ts | 0 frontend/wailsjs/runtime/runtime.js | 4 ++ go.mod | 4 +- go.sum | 8 +-- scripts/build-and-release.sh | 13 ++++- scripts/update-homebrew.sh | 81 +++++++++++++++++++++++++++ 8 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 .claude/settings.local.json mode change 100644 => 100755 frontend/wailsjs/runtime/package.json mode change 100644 => 100755 frontend/wailsjs/runtime/runtime.d.ts mode change 100644 => 100755 frontend/wailsjs/runtime/runtime.js create mode 100755 scripts/update-homebrew.sh diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..d7c9fcc --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,13 @@ +{ + "permissions": { + "allow": [ + "Bash(gh repo view:*)", + "Bash(gh release list:*)", + "Bash(gh release view:*)", + "WebFetch(domain:raw.githubusercontent.com)", + "WebFetch(domain:github.com)" + ], + "deny": [], + "ask": [] + } +} diff --git a/frontend/wailsjs/runtime/package.json b/frontend/wailsjs/runtime/package.json old mode 100644 new mode 100755 diff --git a/frontend/wailsjs/runtime/runtime.d.ts b/frontend/wailsjs/runtime/runtime.d.ts old mode 100644 new mode 100755 diff --git a/frontend/wailsjs/runtime/runtime.js b/frontend/wailsjs/runtime/runtime.js old mode 100644 new mode 100755 index 623397b..7cb89d7 --- a/frontend/wailsjs/runtime/runtime.js +++ b/frontend/wailsjs/runtime/runtime.js @@ -48,6 +48,10 @@ export function EventsOff(eventName, ...additionalEventNames) { return window.runtime.EventsOff(eventName, ...additionalEventNames); } +export function EventsOffAll() { + return window.runtime.EventsOffAll(); +} + export function EventsOnce(eventName, callback) { return EventsOnMultiple(eventName, callback, 1); } diff --git a/go.mod b/go.mod index 260ab4e..0c1dffb 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/google/uuid v1.6.0 - github.com/wailsapp/wails/v2 v2.10.2 + github.com/wailsapp/wails/v2 v2.11.0 ) require ( @@ -28,7 +28,7 @@ require ( github.com/tkrajina/go-reflector v0.5.8 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - github.com/wailsapp/go-webview2 v1.0.19 // indirect + github.com/wailsapp/go-webview2 v1.0.22 // indirect github.com/wailsapp/mimetype v1.4.1 // indirect golang.org/x/crypto v0.33.0 // indirect golang.org/x/net v0.35.0 // indirect diff --git a/go.sum b/go.sum index b1e0229..e3658ec 100644 --- a/go.sum +++ b/go.sum @@ -53,12 +53,12 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyTImA6NU= -github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc= +github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58= +github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= -github.com/wailsapp/wails/v2 v2.10.2 h1:29U+c5PI4K4hbx8yFbFvwpCuvqK9VgNv8WGobIlKlXk= -github.com/wailsapp/wails/v2 v2.10.2/go.mod h1:XuN4IUOPpzBrHUkEd7sCU5ln4T/p1wQedfxP7fKik+4= +github.com/wailsapp/wails/v2 v2.11.0 h1:seLacV8pqupq32IjS4Y7V8ucab0WZwtK6VvUVxSBtqQ= +github.com/wailsapp/wails/v2 v2.11.0/go.mod h1:jrf0ZaM6+GBc1wRmXsM8cIvzlg0karYin3erahI4+0k= golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= diff --git a/scripts/build-and-release.sh b/scripts/build-and-release.sh index 39a31cb..1d8c77a 100755 --- a/scripts/build-and-release.sh +++ b/scripts/build-and-release.sh @@ -93,4 +93,15 @@ Built with Wails v2" \ "${ASSETS[@]}" fi -echo "Release created/updated: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$GIT_TAG" \ No newline at end of file +echo "Release created/updated: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$GIT_TAG" + +echo "" +echo "Updating Homebrew cask..." +if ./scripts/update-homebrew.sh "$VERSION"; then + echo "" + echo "Homebrew cask updated successfully!" +else + echo "" + echo "Warning: Failed to update Homebrew cask. You may need to update it manually." + echo "Run: ./scripts/update-homebrew.sh $VERSION" +fi \ No newline at end of file diff --git a/scripts/update-homebrew.sh b/scripts/update-homebrew.sh new file mode 100755 index 0000000..485a4aa --- /dev/null +++ b/scripts/update-homebrew.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -e + +HOMEBREW_TAP_REPO="STRRL/homebrew-collective" +CASK_NAME="transcube" +TEMP_DIR=$(mktemp -d) + +cleanup() { + rm -rf "$TEMP_DIR" +} +trap cleanup EXIT + +echo "Updating Homebrew cask for $CASK_NAME..." +echo "" + +if [[ $# -eq 1 ]]; then + VERSION="$1" +else + GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") + if [[ -z "$GIT_TAG" ]]; then + echo "Error: No version specified and no git tag found." + echo "Usage: $0 [VERSION]" + echo "Example: $0 0.1.10" + exit 1 + fi + VERSION="${GIT_TAG#v}" +fi + +echo "Version: $VERSION" + +DMG_NAME="TransCube-${VERSION}-macOS.dmg" +DMG_PATH="build/bin/$DMG_NAME" + +if [[ ! -f "$DMG_PATH" ]]; then + echo "Error: DMG file not found at $DMG_PATH" + echo "Please run build-and-release.sh first." + exit 1 +fi + +echo "Calculating SHA256 for $DMG_NAME..." +SHA256=$(shasum -a 256 "$DMG_PATH" | awk '{print $1}') +echo "SHA256: $SHA256" +echo "" + +echo "Cloning homebrew-collective repository..." +cd "$TEMP_DIR" +git clone "https://github.com/$HOMEBREW_TAP_REPO.git" tap +cd tap + +CASK_FILE="Casks/${CASK_NAME}.rb" + +if [[ ! -f "$CASK_FILE" ]]; then + echo "Error: Cask file not found at $CASK_FILE" + exit 1 +fi + +echo "Updating $CASK_FILE..." + +sed -i '' "s/version \".*\"/version \"$VERSION\"/" "$CASK_FILE" +sed -i '' "s/sha256 \".*\"/sha256 \"$SHA256\"/" "$CASK_FILE" + +if git diff --quiet "$CASK_FILE"; then + echo "No changes detected in $CASK_FILE. Version might already be up to date." + exit 0 +fi + +echo "" +echo "Changes to be committed:" +git diff "$CASK_FILE" +echo "" + +git add "$CASK_FILE" +git commit -m "chore: update $CASK_NAME to $VERSION" + +echo "Pushing to $HOMEBREW_TAP_REPO..." +git push origin master + +echo "" +echo "Successfully updated Homebrew cask to version $VERSION" +echo "Users can now run: brew upgrade $CASK_NAME" From 2c4a82e14a2d340ef4a1cd4f9fbb164badf3625d Mon Sep 17 00:00:00 2001 From: Zhiqiang ZHOU Date: Sat, 29 Nov 2025 18:24:21 -0800 Subject: [PATCH 2/2] chore(frontend): fix file permissions for wailsjs runtime files Remove executable permissions from runtime JavaScript/TypeScript files that should be regular files (644 instead of 755). Co-Authored-By: Claude --- frontend/wailsjs/runtime/package.json | 0 frontend/wailsjs/runtime/runtime.d.ts | 0 frontend/wailsjs/runtime/runtime.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 frontend/wailsjs/runtime/package.json mode change 100755 => 100644 frontend/wailsjs/runtime/runtime.d.ts mode change 100755 => 100644 frontend/wailsjs/runtime/runtime.js diff --git a/frontend/wailsjs/runtime/package.json b/frontend/wailsjs/runtime/package.json old mode 100755 new mode 100644 diff --git a/frontend/wailsjs/runtime/runtime.d.ts b/frontend/wailsjs/runtime/runtime.d.ts old mode 100755 new mode 100644 diff --git a/frontend/wailsjs/runtime/runtime.js b/frontend/wailsjs/runtime/runtime.js old mode 100755 new mode 100644