From b6b9f55d7488ff7c3013cb8bfe9978872c3b7c52 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 12 Dec 2025 15:50:41 +0800 Subject: [PATCH] adjust update manager test directory structure, and improve release workflow for binary updates --- .github/workflows/release.yml | 18 +++++++++++++++++- mole | 2 +- tests/update_manager.bats | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 420c73f..be69ded 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,14 +47,30 @@ jobs: - name: Commit binaries for release run: | + # Configure Git git config user.name "Tw93" git config user.email "tw93@qq.com" + + # Save binaries to temp location + cp bin/analyze-go /tmp/analyze-go + cp bin/status-go /tmp/status-go + + # Switch to main branch + git fetch origin main + git checkout main + git pull origin main + + # Restore binaries + mv /tmp/analyze-go bin/analyze-go + mv /tmp/status-go bin/status-go + + # Commit and Push git add bin/analyze-go bin/status-go if git diff --staged --quiet; then echo "No changes to commit" else git commit -m "chore: update binaries for ${GITHUB_REF#refs/tags/}" - git push origin HEAD:main + git push origin main fi update-formula: diff --git a/mole b/mole index 6073d2f..77d29fe 100755 --- a/mole +++ b/mole @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/lib/core/common.sh" # Version info -VERSION="1.12.15" +VERSION="1.12.16" MOLE_TAGLINE="can dig deep to clean your Mac." # Check if Touch ID is already configured diff --git a/tests/update_manager.bats b/tests/update_manager.bats index 1328501..23d9436 100644 --- a/tests/update_manager.bats +++ b/tests/update_manager.bats @@ -115,13 +115,13 @@ BREW_CASK_OUTDATED_COUNT=0 MOLE_UPDATE_AVAILABLE=true FAKE_DIR="$HOME/fake-script-dir" -mkdir -p "$FAKE_DIR" +mkdir -p "$FAKE_DIR/lib/manage" cat > "$FAKE_DIR/mole" <<'SCRIPT' #!/usr/bin/env bash echo "Already on latest version" SCRIPT chmod +x "$FAKE_DIR/mole" -SCRIPT_DIR="$FAKE_DIR" +SCRIPT_DIR="$FAKE_DIR/lib/manage" brew_has_outdated() { return 0; } start_inline_spinner() { :; }