Skip to content

Commit 64002be

Browse files
committed
Fix macOS Gatekeeper warning by building from source
1 parent f3e3f0e commit 64002be

2 files changed

Lines changed: 39 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,40 @@ jobs:
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
34-
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
34+
35+
- name: Update Homebrew Tap (Build from Source)
36+
env:
37+
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
38+
VERSION: ${{ github.ref_name }}
39+
run: |
40+
URL="https://github.com/jvherck/git-janitor/archive/refs/tags/${VERSION}.tar.gz"
41+
curl -sL $URL -o source.tar.gz
42+
SHA256=$(sha256sum source.tar.gz | awk '{print $1}')
43+
DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
44+
COMMIT=$(git rev-parse --short HEAD)
45+
46+
git clone https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/jvherck/homebrew-tap.git tap-repo
47+
mkdir -p tap-repo/Formula
48+
49+
cat <<EOF > tap-repo/Formula/git-janitor.rb
50+
class GitJanitor < Formula
51+
desc "A fast, interactive TUI for cleaning up local Git branches."
52+
homepage "https://github.com/jvherck/git-janitor"
53+
url "$URL"
54+
sha256 "$SHA256"
55+
license "MIT"
56+
57+
depends_on "go" => :build
58+
59+
def install
60+
system "go", "build", "-ldflags", "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}", "-o", bin/"git-janitor", "."
61+
end
62+
end
63+
EOF
64+
65+
cd tap-repo
66+
git config user.name "github-actions[bot]"
67+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
68+
git add Formula/git-janitor.rb
69+
git commit -m "Update git-janitor formula to ${VERSION}"
70+
git push

.goreleaser.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,7 @@ nfpms:
5353
- rpm
5454
- apk
5555

56-
homebrew_casks:
57-
- repository:
58-
owner: jvherck
59-
name: homebrew-tap
60-
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
61-
directory: Casks
62-
homepage: "https://github.com/jvherck/git-janitor"
63-
description: "A fast, interactive TUI for cleaning up local Git branches."
64-
license: MIT
56+
# Homebrew is handled separately in .github/workflows/release.yml
6557

6658
scoops:
6759
- repository:
@@ -85,7 +77,7 @@ release:
8577
owner: jvherck
8678
name: git-janitor
8779
footer: |
88-
## 🚀 How to Update
80+
## How to Update
8981
9082
If you already have Git Janitor installed, you can update to this version using your package manager:
9183

0 commit comments

Comments
 (0)