Skip to content
Closed
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
7 changes: 6 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_GITHUB_TOKEN below.
permissions:
contents: write

Expand All @@ -29,10 +30,12 @@ jobs:
env:
APP_ID: ${{ secrets.APP_ID }}
APP_HASH: ${{ secrets.APP_HASH }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
run: |
missing=
[ -n "$APP_ID" ] || missing="$missing APP_ID"
[ -n "$APP_HASH" ] || missing="$missing APP_HASH"
[ -n "$HOMEBREW_TAP_GITHUB_TOKEN" ] || missing="$missing HOMEBREW_TAP_GITHUB_TOKEN"
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,8 @@ jobs:
# tdesktop fallback.
APP_ID: ${{ secrets.APP_ID }}
APP_HASH: ${{ secrets.APP_HASH }}
# Cross-repository publishing cannot use GITHUB_TOKEN.
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

- name: Upload assets
uses: actions/upload-artifact@v7.0.1
Expand Down
19 changes: 18 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,21 @@ 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: |
if OS.mac?
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/tg"]
end
repository:
owner: gotd
name: homebrew-tap
branch: main
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
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