Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
# Formula/cdclint.rb in the tap builds from the tagged source, the
# way homebrew/core would; goreleaser writes only the cask, so this
# rewrites the formula's url and sha256 to this tag. The hash is of
# GitHub's source tarball for the tag, which GitHub keeps stable for
# tags. Only for a final release, like the major tag below.
- name: Bump the tap formula
if: ${{ !contains(github.ref_name, '-') }}
shell: bash
env:
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
run: |
set -euo pipefail
tag="$GITHUB_REF_NAME"
url="https://github.com/avison9/cdclint/archive/refs/tags/${tag}.tar.gz"
sha="$(curl -fsSL "$url" | sha256sum | awk '{print $1}')"
git clone -q --depth=1 "https://x-access-token:${TAP_TOKEN}@github.com/avison9/homebrew-tap.git" "$RUNNER_TEMP/tap"
cd "$RUNNER_TEMP/tap"
sed -i -E "s|^( url \").*(\")$|\1${url}\2|; s|^( sha256 \").*(\")$|\1${sha}\2|" Formula/cdclint.rb
grep -q "$sha" Formula/cdclint.rb
git config user.name "avison9"
git config user.email "avisonlivingstone@gmail.com"
git commit -qam "cdclint ${tag} formula"
git push -q origin HEAD:main
echo "formula: ${url} ${sha}"
# `uses: avison9/cdclint@v1` needs a v1 tag that follows the newest
# v1.x.y release. goreleaser does not move tags, so this does, after
# the release exists and only for a final release (v1.2.3, not
Expand Down
18 changes: 14 additions & 4 deletions INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ ARM).
brew install avison9/tap/cdclint
```

Updates come with `brew upgrade`. The cask clears the quarantine attribute
after install, so Gatekeeper does not block the first run.
That builds from the tagged source, the way homebrew/core does: Homebrew
installs `go` as a build dependency (once, from a bottle), then the build
takes seconds. For the release binary instead, no Go involved:

```
brew install --cask avison9/tap/cdclint
```

Updates come with `brew upgrade` either way. The cask clears the
quarantine attribute after install, so Gatekeeper does not block the
first run; a formula build is never quarantined.

**Release archive**, without Homebrew:

Expand All @@ -44,10 +53,11 @@ xattr -d com.apple.quarantine /usr/local/bin/cdclint

## Linux

**Homebrew on Linux** works the same as on macOS:
**Homebrew on Linux** works the same as on macOS, formula or cask:

```
brew install avison9/tap/cdclint
brew install --cask avison9/tap/cdclint
```

**Release archive** (any distribution, no package manager needed):
Expand Down Expand Up @@ -170,7 +180,7 @@ The GitHub Action does the first check on every run.

| installed with | remove with |
|---|---|
| Homebrew | `brew uninstall cdclint` |
| Homebrew | `brew uninstall cdclint`, or `brew uninstall --cask cdclint` for the cask |
| release archive | delete the binary from where you put it |
| Go | `rm "$(go env GOPATH)/bin/cdclint"` |
| Windows archive | delete `%LOCALAPPDATA%\Programs\cdclint` and the PATH entry |
Expand Down
12 changes: 8 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ The `release` workflow then:
5. creates the GitHub Release with a changelog from the commits since the
previous tag,
6. writes `Casks/cdclint.rb` to `avison9/homebrew-tap`,
7. moves the major tag (`v0`, later `v1`) to this release, which is what
7. rewrites `Formula/cdclint.rb`'s `url` and `sha256` in the tap to this
tag's source tarball (the formula builds from source, the shape
homebrew/core wants; the rest of the file is by hand),
8. moves the major tag (`v0`, later `v1`) to this release, which is what
`uses: avison9/cdclint@v0` resolves.

Check the run, then check the three places a user meets it: the Release
page, `brew install avison9/tap/cdclint` on a Mac or Linux box, and a
workflow using the action.
Check the run, then check the places a user meets it: the Release page,
`brew install avison9/tap/cdclint` (the formula, builds from source) and
`brew install --cask avison9/tap/cdclint` (the binary) on a Mac or Linux
box, and a workflow using the action.

## Trying the build without releasing

Expand Down