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
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
tags:
- '*'

# Least privilege: goreleaser only needs to create the release / upload assets.
# Least privilege for the release repository. Publishing to the separate
# Homebrew tap uses HOMEBREW_TAP_DEPLOY_KEY below.
permissions:
contents: write

Expand All @@ -29,10 +30,12 @@ jobs:
env:
APP_ID: ${{ secrets.APP_ID }}
APP_HASH: ${{ secrets.APP_HASH }}
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
run: |
missing=
[ -n "$APP_ID" ] || missing="$missing APP_ID"
[ -n "$APP_HASH" ] || missing="$missing APP_HASH"
[ -n "$HOMEBREW_TAP_DEPLOY_KEY" ] || missing="$missing HOMEBREW_TAP_DEPLOY_KEY"
if [ -n "$missing" ]; then
echo "::error::Missing required release secret(s):$missing. Set them with: gh secret set <NAME>"
exit 1
Expand All @@ -53,6 +56,9 @@ jobs:
# tdesktop fallback.
APP_ID: ${{ secrets.APP_ID }}
APP_HASH: ${{ secrets.APP_HASH }}
# Write deploy key of gotd/homebrew-tap: cross-repository publishing
# cannot use GITHUB_TOKEN.
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}

- name: Upload assets
uses: actions/upload-artifact@v7.0.2
Expand Down
25 changes: 24 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,27 @@ nfpms:
formats:
- apk
- deb
- rpm
- rpm
homebrew_casks:
- name: tg
binaries:
- tg
homepage: https://github.com/gotd/cli
description: Telegram CLI for humans and agents
hooks:
post:
# install_steps needs GoReleaser v2.19+; the older `install` hook
# renders the `postflight` stanza that Homebrew 7 deprecates.
install_steps: |
on_macos do
run "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "{{ .StagedPath }}/tg"]
end
# Pushed over SSH with a write deploy key that is scoped to the tap
# repository only (GITHUB_TOKEN cannot write to another repository).
repository:
owner: gotd
name: homebrew-tap
branch: main
git:
url: git@github.com:gotd/homebrew-tap.git
private_key: "{{ .Env.HOMEBREW_TAP_DEPLOY_KEY }}"
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ Built on [`gotd/td`](https://github.com/gotd/td).

## Installation

Download a prebuilt binary or package (`.deb`/`.rpm`/`.apk`) for your platform from
the [latest release](https://github.com/gotd/cli/releases/latest).
Install with Homebrew:

```console
$ brew install --cask gotd/tap/tg
```

GoReleaser updates the tap when a new version is published, so future updates
use the regular Homebrew flow:

```console
$ brew upgrade tg
```

Alternatively, download a prebuilt binary or package (`.deb`/`.rpm`/`.apk`) for
your platform from the [latest release](https://github.com/gotd/cli/releases/latest).

## Quick start

Expand Down
Loading