@@ -67,19 +67,22 @@ jobs:
6767 repositories : homebrew-tap
6868
6969 - name : Install cosign
70- uses : sigstore/cosign-installer@v3
70+ uses : sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # v3
7171
7272 - name : Install Syft
73- uses : anchore/sbom-action/download-syft@v0
73+ uses : anchore/sbom-action/download-syft@17ae1740179002c89186b61233e0f892c3118b11 # v0
7474
7575 - name : Generate shell completions
7676 run : |
77- VERSION=${GITHUB_REF_NAME#v}
78- curl -sL "https://github.com/basecamp/fizzy-cli/releases/download/v${VERSION}/fizzy-linux-${{ matrix.goarch }}" -o fizzy
79- chmod +x fizzy
77+ go build -o fizzy-tmp ./cmd/fizzy
78+ mkdir -p completions
79+ ./fizzy-tmp completion bash > completions/fizzy.bash
80+ ./fizzy-tmp completion zsh > completions/fizzy.zsh
81+ ./fizzy-tmp completion fish > completions/fizzy.fish
82+ rm fizzy-tmp
8083
8184 - name : Run GoReleaser
82- uses : goreleaser/goreleaser-action@v6
85+ uses : goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
8386 with :
8487 version : ' ~> v2'
8588 args : release --clean
@@ -104,108 +107,14 @@ jobs:
104107 env :
105108 AUR_KEY : ${{ secrets.AUR_KEY }}
106109 run : |
107- VERSION=${GITHUB_REF_NAME#v}
108-
109- # Download source tarball and calculate checksum
110- curl -sL "https://github.com/basecamp/fizzy-cli/archive/v${VERSION}.tar.gz" -o source.tar.gz
111- SHA256=$(sha256sum source.tar.gz | cut -d' ' -f1)
112-
113- # Generate PKGBUILD
114- cat > PKGBUILD << 'EOF'
115- # Maintainer: 37signals <support@37signals.com>
116- pkgname=fizzy-cli
117- pkgver=VERSION_PLACEHOLDER
118- pkgrel=1
119- pkgdesc="CLI for managing Fizzy boards, cards, and tasks"
120- arch=('x86_64' 'aarch64')
121- url="https://github.com/basecamp/fizzy-cli"
122- license=('MIT')
123- depends=('glibc')
124- makedepends=('go')
125- source=("$pkgname-$pkgver.tar.gz::https://github.com/basecamp/fizzy-cli/archive/v$pkgver.tar.gz")
126- sha256sums=('SHA256_PLACEHOLDER')
127- options=('!debug')
128-
129- build() {
130- cd "$pkgname-$pkgver"
131- export CGO_CPPFLAGS="${CPPFLAGS}"
132- export CGO_CFLAGS="${CFLAGS}"
133- export CGO_CXXFLAGS="${CXXFLAGS}"
134- export CGO_LDFLAGS="${LDFLAGS}"
135- export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
136- go build -ldflags "-s -w -X main.version=${pkgver}" -o fizzy ./cmd/fizzy
137- }
138-
139- package() {
140- cd "$pkgname-$pkgver"
141- install -Dm755 fizzy "$pkgdir/usr/bin/fizzy"
142- install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
143- }
144- EOF
145-
146- # Remove leading whitespace from PKGBUILD
147- sed -i 's/^ //' PKGBUILD
148-
149- # Replace placeholders
150- sed -i "s/VERSION_PLACEHOLDER/$VERSION/" PKGBUILD
151- sed -i "s/SHA256_PLACEHOLDER/$SHA256/" PKGBUILD
110+ if [ -n "$AUR_KEY" ]; then
111+ echo "available=true" >> "$GITHUB_OUTPUT"
112+ fi
152113
153114 - name : Publish to AUR
154115 if : steps.check.outputs.available == 'true'
155116 run : |
156- VERSION=${GITHUB_REF_NAME#v}
157-
158- # Download SHA256 files
159- curl -sL "https://github.com/basecamp/fizzy-cli/releases/download/v${VERSION}/SHA256SUMS-darwin-amd64.txt" -o sha256-amd64.txt
160- curl -sL "https://github.com/basecamp/fizzy-cli/releases/download/v${VERSION}/SHA256SUMS-darwin-arm64.txt" -o sha256-arm64.txt
161-
162- SHA256_AMD64=$(cut -d' ' -f1 sha256-amd64.txt)
163- SHA256_ARM64=$(cut -d' ' -f1 sha256-arm64.txt)
164-
165- # Generate formula
166- cat > fizzy-cli.rb << 'FORMULA'
167- class FizzyCli < Formula
168- desc "CLI for managing Fizzy boards, cards, and tasks"
169- homepage "https://github.com/basecamp/fizzy-cli"
170- version "VERSION_PLACEHOLDER"
171- license "MIT"
172-
173- on_macos do
174- if Hardware::CPU.arm?
175- url "https://github.com/basecamp/fizzy-cli/releases/download/v#{version}/fizzy-darwin-arm64"
176- sha256 "SHA256_ARM64_PLACEHOLDER"
177- else
178- url "https://github.com/basecamp/fizzy-cli/releases/download/v#{version}/fizzy-darwin-amd64"
179- sha256 "SHA256_AMD64_PLACEHOLDER"
180- end
181- end
182-
183- def install
184- binary_name = Hardware::CPU.arm? ? "fizzy-darwin-arm64" : "fizzy-darwin-amd64"
185- bin.install binary_name => "fizzy"
186- end
187-
188- test do
189- assert_match version.to_s, shell_output("#{bin}/fizzy --version")
190- end
191- end
192- FORMULA
193-
194- # Remove leading whitespace and replace placeholders
195- sed -i 's/^ //' fizzy-cli.rb
196- sed -i "s/VERSION_PLACEHOLDER/${VERSION}/" fizzy-cli.rb
197- sed -i "s/SHA256_ARM64_PLACEHOLDER/${SHA256_ARM64}/" fizzy-cli.rb
198- sed -i "s/SHA256_AMD64_PLACEHOLDER/${SHA256_AMD64}/" fizzy-cli.rb
199-
200- # Clone tap repo, update formula, push
201- git clone https://x-access-token:${GH_TOKEN}@github.com/robzolkos/homebrew-fizzy-cli.git
202- cd homebrew-fizzy-cli
203- cp ../fizzy-cli.rb Formula/fizzy-cli.rb
204- git config user.name "github-actions[bot]"
205- git config user.email "github-actions[bot]@users.noreply.github.com"
206- git add Formula/fizzy-cli.rb
207- git commit -m "Update fizzy-cli to ${VERSION}"
208- git push
117+ scripts/publish-aur.sh
209118 env :
210119 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
211120 AUR_KEY : ${{ secrets.AUR_KEY }}
0 commit comments