From 4d2cfecfd630b73dc185a94728d829f6cca7299f Mon Sep 17 00:00:00 2001 From: l2D <20911264+l2D@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:14:10 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=91=B7=20ci:=20automate=20Homebrew=20?= =?UTF-8?q?formula=20updates=20via=20GoReleaser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add brews configuration to .goreleaser.yml for automatic formula generation - configure formula metadata (description, license, homepage, install, test) - pass HOMEBREW_TAP_TOKEN in release workflow for cross-repo authentication --- .github/workflows/release.yml | 1 + .goreleaser.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 928e48c..fa725ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,7 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} - name: Run GoReleaser (Dry Run) if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run) diff --git a/.goreleaser.yml b/.goreleaser.yml index c26fd35..63b960a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -70,6 +70,22 @@ changelog: - '^chore:' - '^ci:' +brews: + - name: azswitch + repository: + owner: l2D + name: homebrew-tap + token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" + directory: Formula + homepage: "https://github.com/l2D/azswitch" + description: "Switch Azure Directory and Subscription with command and TUI" + license: "MIT" + install: | + bin.install "azswitch" + test: | + system "#{bin}/azswitch", "--version" + commit_msg_template: "chore(formula): update {{ .ProjectName }} to version {{ .Tag }}" + release: github: owner: l2D From 9b48888ced11e9b4a1b953a5764c373983603e16 Mon Sep 17 00:00:00 2001 From: l2D <20911264+l2D@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:16:45 +0700 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20fix(release):=20allow=20manu?= =?UTF-8?q?al=20dispatch=20to=20run=20actual=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - update "Run GoReleaser (Release)" condition to include workflow_dispatch with dry_run=false - update "Run GoReleaser (Dry Run)" condition to explicitly check dry_run=true - update "Login to GitHub Container Registry" to also run on manual release dispatch --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa725ee..f280a50 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) uses: docker/login-action@v3 with: registry: ghcr.io @@ -56,7 +56,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser (Release) - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser @@ -67,7 +67,7 @@ jobs: HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} - name: Run GoReleaser (Dry Run) - if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run) + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == true) uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser From fcbcd1930eb4540fb01bec727479d46d6c862769 Mon Sep 17 00:00:00 2001 From: l2D <20911264+l2D@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:27:56 +0700 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20fix(release):=20handle=20tag?= =?UTF-8?q?less=20manual=20dispatch=20in=20GoReleaser=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add "Check for Git tag" step to detect tag presence and export TAG_PRESENT output - split release into "Run GoReleaser (Release)" for tag pushes only - add "Run GoReleaser (Manual Release)" for workflow_dispatch with conditional --snapshot - update "Run GoReleaser (Dry Run)" to explicitly check dry_run == true --- .github/workflows/release.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f280a50..35e03cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,6 +47,23 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Check for Git tag + id: check_tag + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + echo "TAG_PRESENT=true" >> $GITHUB_OUTPUT + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + else + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [[ -n "$LATEST_TAG" ]]; then + echo "TAG_PRESENT=false" >> $GITHUB_OUTPUT + echo "TAG_NAME=$LATEST_TAG" >> $GITHUB_OUTPUT + else + echo "TAG_PRESENT=false" >> $GITHUB_OUTPUT + echo "TAG_NAME=v0.0.0" >> $GITHUB_OUTPUT + fi + fi + - name: Login to GitHub Container Registry if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) uses: docker/login-action@v3 @@ -56,7 +73,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser (Release) - if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && inputs.dry_run == false) + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser @@ -66,6 +83,17 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + - name: Run GoReleaser (Manual Release) + if: github.event_name == 'workflow_dispatch' && inputs.dry_run == false + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: '~> v2' + args: release --clean ${{ steps.check_tag.outputs.TAG_PRESENT == 'false' && '--snapshot' || '' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + - name: Run GoReleaser (Dry Run) if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run == true) uses: goreleaser/goreleaser-action@v6