From b4773846ee7f0129abad08c6820f15faaa13ba4b Mon Sep 17 00:00:00 2001 From: Nimish Date: Wed, 11 Mar 2026 18:26:38 +0800 Subject: [PATCH 1/4] Release v2.0.0: Go CLI with raw binary downloads - Update formula to download raw binaries instead of zips (no more _internal dir) - Update URLs to new naming convention: phase_cli_{version}_darwin_{arch} - Add upgrade test CI job to verify 1.x -> 2.x upgrade path --- .github/workflows/cli-package-test.yml | 76 ++++++++++++++++++++++++-- phase.rb | 19 ++----- 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cli-package-test.yml b/.github/workflows/cli-package-test.yml index 5aedf26..3a75e56 100644 --- a/.github/workflows/cli-package-test.yml +++ b/.github/workflows/cli-package-test.yml @@ -26,7 +26,7 @@ jobs: arch=$(uname -m) echo "Running on architecture: $arch" if [[ "${{ matrix.os }}" == "macos-15-intel" && "$arch" != "x86_64" ]]; then - echo "Error: Expected x86_64 architecture for macOS 13" + echo "Error: Expected x86_64 architecture for macOS Intel" exit 1 elif [[ "${{ matrix.os }}" =~ "macos-1[45]" && "$arch" != "arm64" ]]; then echo "Error: Expected arm64 architecture for ${{ matrix.os }}" @@ -43,9 +43,9 @@ jobs: - name: Install CLI from local formula (PRs only) if: github.event_name == 'pull_request' run: | - mkdir -p "$(brew --repo phasehq/cli)/Formula" - cp ./phase.rb "$(brew --repo phasehq/cli)/Formula/phase.rb" - brew install --build-from-source phasehq/cli/phase + brew tap phasehq/cli + cp ./phase.rb "$(brew --repo phasehq/cli)/phase.rb" + HOMEBREW_NO_AUTO_UPDATE=1 brew install phasehq/cli/phase - name: Install CLI from tap (main branch only) if: github.event_name == 'push' && github.ref == 'refs/heads/main' @@ -56,7 +56,7 @@ jobs: id: extract-version run: | version_line=$(grep 'version' phase.rb) - version=$(echo $version_line | awk -F '\"' '{print $2}') + version=$(echo $version_line | awk -F '"' '{print $2}') echo "version=$version" >> $GITHUB_OUTPUT - name: Test CLI Version @@ -70,3 +70,69 @@ jobs: exit 1 fi shell: bash + + homebrew-upgrade-test: + name: Upgrade test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + if: github.event_name == 'pull_request' + strategy: + matrix: + os: [macos-14, macos-15-intel] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Homebrew + run: | + if ! command -v brew &>/dev/null; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + brew update + + - name: Install old version from published tap + run: | + brew install phasehq/cli/phase + echo "Installed version: $(phase --version)" + + - name: Verify old version is 1.x + run: | + version=$(phase --version) + if [[ ! "$version" =~ ^1\. ]]; then + echo "Expected 1.x version, got: $version" + exit 1 + fi + echo "Old version confirmed: $version" + + - name: Upgrade to new version from PR + run: | + cp ./phase.rb "$(brew --repo phasehq/cli)/phase.rb" + HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade phasehq/cli/phase + + - name: Extract Expected Version + id: extract-version + run: | + version_line=$(grep 'version' phase.rb) + version=$(echo $version_line | awk -F '"' '{print $2}') + echo "version=$version" >> $GITHUB_OUTPUT + + - name: Verify upgrade succeeded + run: | + expected="${{ steps.extract-version.outputs.version }}" + actual=$(phase --version) + echo "Expected: $expected" + echo "Actual: $actual" + if [ "$actual" != "$expected" ]; then + echo "Version mismatch after upgrade!" + exit 1 + fi + + - name: Verify old Python artifacts removed + run: | + phase_prefix="$(brew --cellar phasehq/cli/phase)" + echo "Cellar path: $phase_prefix" + if [ -d "$phase_prefix/_internal" ] || find "$phase_prefix" -name "_internal" -type d 2>/dev/null | grep -q .; then + echo "ERROR: _internal directory still exists after upgrade" + exit 1 + fi + echo "Old Python artifacts properly cleaned up" diff --git a/phase.rb b/phase.rb index 1f5597c..2b204e4 100644 --- a/phase.rb +++ b/phase.rb @@ -1,29 +1,22 @@ class Phase < Formula desc "Securely manage your secrets and environment variables with Phase." homepage "https://github.com/phasehq/cli" - version "1.21.3" + version "2.0.0" on_macos do on_arm do - url "https://github.com/phasehq/cli/releases/download/v#{version}/phase_cli_macos_arm64_#{version}.zip" - sha256 "5810fa35e1a2c62628a06b293b20f9cd4dc693210295851efb134971266fb444" + url "https://github.com/phasehq/cli/releases/download/v#{version}/phase_cli_#{version}_darwin_arm64" + sha256 "c0e9824b192dac0e4b2cbf80412638e6790bc95f36387362869a31fac21a8184" end on_intel do - url "https://github.com/phasehq/cli/releases/download/v#{version}/phase_cli_macos_amd64_#{version}.zip" - sha256 "02abc2aa71d3e9be9fa2a74af3cd81fb7f349f81485c343b1b9a58b750fd7a78" + url "https://github.com/phasehq/cli/releases/download/v#{version}/phase_cli_#{version}_darwin_amd64" + sha256 "ae3dea0fdedfb4dcff24de4de96a1e0070e45935f90ead3857e08218dba0af25" end end def install - # Install the phase binary - bin.install "phase/phase" - - # Install the _internal directory in the bin directory - bin.install "phase/_internal" - - # Set execution permissions for the phase binary - chmod 0755, bin/"phase" + bin.install Dir["phase_cli_*"].first => "phase" end test do From a4b190d600c3b709fab9ac0eecea03f89cc2620a Mon Sep 17 00:00:00 2001 From: Nimish Date: Wed, 11 Mar 2026 18:31:14 +0800 Subject: [PATCH 2/4] fix: check active prefix instead of entire Cellar for _internal brew --cellar returns the parent dir with all versions, so the old 1.x _internal dir was found. Use brew --prefix (active linked version) and run brew cleanup to remove stale versions. --- .github/workflows/cli-package-test.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli-package-test.yml b/.github/workflows/cli-package-test.yml index 3a75e56..9fed806 100644 --- a/.github/workflows/cli-package-test.yml +++ b/.github/workflows/cli-package-test.yml @@ -129,10 +129,18 @@ jobs: - name: Verify old Python artifacts removed run: | - phase_prefix="$(brew --cellar phasehq/cli/phase)" - echo "Cellar path: $phase_prefix" - if [ -d "$phase_prefix/_internal" ] || find "$phase_prefix" -name "_internal" -type d 2>/dev/null | grep -q .; then - echo "ERROR: _internal directory still exists after upgrade" + # brew --prefix gives the active (linked) version's prefix + phase_prefix="$(brew --prefix phasehq/cli/phase)" + echo "Active prefix: $phase_prefix" + ls -la "$phase_prefix/bin/" + + if [ -d "$phase_prefix/bin/_internal" ]; then + echo "ERROR: _internal directory exists in active installation" exit 1 fi - echo "Old Python artifacts properly cleaned up" + echo "Active installation has no old Python artifacts" + + # Clean up old versions from the Cellar + brew cleanup phase + echo "Cellar after cleanup:" + ls "$(brew --cellar phase)/" From d1e06bf82caf384de44392777554eaf17544f0c4 Mon Sep 17 00:00:00 2001 From: Nimish Date: Wed, 11 Mar 2026 18:37:18 +0800 Subject: [PATCH 3/4] fix: drop post_install hook, simplify upgrade verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Brew handles symlinks correctly — the active binary always points to the current version. No need to delete old Cellar entries. --- .github/workflows/cli-package-test.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cli-package-test.yml b/.github/workflows/cli-package-test.yml index 9fed806..d89cc7e 100644 --- a/.github/workflows/cli-package-test.yml +++ b/.github/workflows/cli-package-test.yml @@ -127,20 +127,9 @@ jobs: exit 1 fi - - name: Verify old Python artifacts removed + - name: Verify active installation is clean run: | - # brew --prefix gives the active (linked) version's prefix - phase_prefix="$(brew --prefix phasehq/cli/phase)" - echo "Active prefix: $phase_prefix" - ls -la "$phase_prefix/bin/" - - if [ -d "$phase_prefix/bin/_internal" ]; then - echo "ERROR: _internal directory exists in active installation" - exit 1 - fi - echo "Active installation has no old Python artifacts" - - # Clean up old versions from the Cellar - brew cleanup phase - echo "Cellar after cleanup:" - ls "$(brew --cellar phase)/" + # Confirm which/phase resolves to the new Go binary, not the old Python bundle + which phase + file "$(which phase)" + phase --version From e067dc37e536b99d208651cdd3984498164ced7c Mon Sep 17 00:00:00 2001 From: Nimish Date: Wed, 11 Mar 2026 18:51:54 +0800 Subject: [PATCH 4/4] chore: remove one-time 1.x -> 2.x upgrade test job --- .github/workflows/cli-package-test.yml | 63 -------------------------- 1 file changed, 63 deletions(-) diff --git a/.github/workflows/cli-package-test.yml b/.github/workflows/cli-package-test.yml index d89cc7e..41b924c 100644 --- a/.github/workflows/cli-package-test.yml +++ b/.github/workflows/cli-package-test.yml @@ -70,66 +70,3 @@ jobs: exit 1 fi shell: bash - - homebrew-upgrade-test: - name: Upgrade test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - if: github.event_name == 'pull_request' - strategy: - matrix: - os: [macos-14, macos-15-intel] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Homebrew - run: | - if ! command -v brew &>/dev/null; then - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - fi - brew update - - - name: Install old version from published tap - run: | - brew install phasehq/cli/phase - echo "Installed version: $(phase --version)" - - - name: Verify old version is 1.x - run: | - version=$(phase --version) - if [[ ! "$version" =~ ^1\. ]]; then - echo "Expected 1.x version, got: $version" - exit 1 - fi - echo "Old version confirmed: $version" - - - name: Upgrade to new version from PR - run: | - cp ./phase.rb "$(brew --repo phasehq/cli)/phase.rb" - HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade phasehq/cli/phase - - - name: Extract Expected Version - id: extract-version - run: | - version_line=$(grep 'version' phase.rb) - version=$(echo $version_line | awk -F '"' '{print $2}') - echo "version=$version" >> $GITHUB_OUTPUT - - - name: Verify upgrade succeeded - run: | - expected="${{ steps.extract-version.outputs.version }}" - actual=$(phase --version) - echo "Expected: $expected" - echo "Actual: $actual" - if [ "$actual" != "$expected" ]; then - echo "Version mismatch after upgrade!" - exit 1 - fi - - - name: Verify active installation is clean - run: | - # Confirm which/phase resolves to the new Go binary, not the old Python bundle - which phase - file "$(which phase)" - phase --version