From 910619bc7a70f28fa1aaf674e420d298067c93bf Mon Sep 17 00:00:00 2001 From: Tam Nguyen Duc <1218621+tamnd@users.noreply.github.com> Date: Fri, 19 Jun 2026 22:44:38 +0700 Subject: [PATCH] Use index .Env for the optional tap and bucket tokens (#50) The Homebrew cask and Scoop manifest stanzas gated their token and skip_upload on envOrDefault, which is a sprig function GoReleaser does not define, so a real release aborted with 'function envOrDefault not defined' the moment it reached the publish phase. goreleaser check does not evaluate templates, so the gate slipped through until a tagged run. Switch to index .Env "NAME", the idiom GoReleaser documents for an optional variable: it yields the token when the secret is set (push the update) and an empty string when it is not (skip_upload stays true). --- .goreleaser.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 3028720..cb06880 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -151,11 +151,11 @@ homebrew_casks: repository: owner: tamnd name: homebrew-tap - token: '{{ envOrDefault "HOMEBREW_TAP_GITHUB_TOKEN" "" }}' + token: '{{ index .Env "HOMEBREW_TAP_GITHUB_TOKEN" }}' directory: Casks homepage: https://github.com/tamnd/kage description: Clone any website for offline viewing, with the JavaScript stripped out - skip_upload: '{{ if envOrDefault "HOMEBREW_TAP_GITHUB_TOKEN" "" }}false{{ else }}true{{ end }}' + skip_upload: '{{ if index .Env "HOMEBREW_TAP_GITHUB_TOKEN" }}false{{ else }}true{{ end }}' commit_author: name: Duc-Tam Nguyen email: tamnd87@gmail.com @@ -168,11 +168,11 @@ scoops: repository: owner: tamnd name: scoop-bucket - token: '{{ envOrDefault "SCOOP_BUCKET_GITHUB_TOKEN" "" }}' + token: '{{ index .Env "SCOOP_BUCKET_GITHUB_TOKEN" }}' homepage: https://github.com/tamnd/kage description: Clone any website for offline viewing, with the JavaScript stripped out license: MIT - skip_upload: '{{ if envOrDefault "SCOOP_BUCKET_GITHUB_TOKEN" "" }}false{{ else }}true{{ end }}' + skip_upload: '{{ if index .Env "SCOOP_BUCKET_GITHUB_TOKEN" }}false{{ else }}true{{ end }}' commit_author: name: Duc-Tam Nguyen email: tamnd87@gmail.com