Skip to content

Commit bcfe180

Browse files
committed
Initial public release
0 parents  commit bcfe180

16 files changed

Lines changed: 3152 additions & 0 deletions

‎.github/workflows/ci.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: rustfmt, clippy
23+
24+
- name: Install check tools
25+
uses: taiki-e/install-action@v2
26+
with:
27+
tool: just,cargo-audit
28+
29+
- name: Run checks
30+
run: just check

‎.github/workflows/release.yml‎

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
include:
16+
- target: aarch64-apple-darwin
17+
os: macos-latest
18+
arch: arm64
19+
- target: x86_64-apple-darwin
20+
os: macos-latest
21+
arch: x86_64
22+
23+
runs-on: ${{ matrix.os }}
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install Rust toolchain
29+
uses: dtolnay/rust-toolchain@stable
30+
with:
31+
targets: ${{ matrix.target }}
32+
33+
- name: Build release binary
34+
run: cargo build --release --target ${{ matrix.target }}
35+
36+
- name: Package binary
37+
run: |
38+
cd target/${{ matrix.target }}/release
39+
tar czf ../../../tgrc-${{ matrix.arch }}-apple-darwin.tar.gz tgrc
40+
cd ../../..
41+
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: tgrc-${{ matrix.arch }}-apple-darwin
46+
path: tgrc-${{ matrix.arch }}-apple-darwin.tar.gz
47+
48+
release:
49+
needs: build
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Download all artifacts
56+
uses: actions/download-artifact@v4
57+
with:
58+
path: artifacts
59+
60+
- name: Create release
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
tag="${GITHUB_REF#refs/tags/}"
65+
if gh release view "$tag" >/dev/null 2>&1; then
66+
echo "Release $tag already exists; skipping creation"
67+
else
68+
gh release create "$tag" \
69+
--title "$tag" \
70+
--generate-notes \
71+
artifacts/tgrc-arm64-apple-darwin/tgrc-arm64-apple-darwin.tar.gz \
72+
artifacts/tgrc-x86_64-apple-darwin/tgrc-x86_64-apple-darwin.tar.gz
73+
fi
74+
75+
update-tap:
76+
needs: release
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- name: Update Homebrew tap
81+
env:
82+
GH_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
83+
run: |
84+
tag="${GITHUB_REF#refs/tags/}"
85+
version="${tag#v}"
86+
87+
# Download the release tarballs and compute checksums
88+
gh release download "$tag" \
89+
--repo jakshi/telegram-rust-cli \
90+
--pattern '*.tar.gz' \
91+
--dir .
92+
93+
sha256_arm64=$(sha256sum tgrc-arm64-apple-darwin.tar.gz | awk '{print $1}')
94+
sha256_x86_64=$(sha256sum tgrc-x86_64-apple-darwin.tar.gz | awk '{print $1}')
95+
96+
git clone "https://x-access-token:${GH_TOKEN}@github.com/jakshi/homebrew-tap.git"
97+
cd homebrew-tap
98+
99+
mkdir -p Formula
100+
101+
# Generate the formula
102+
cat > Formula/tgrc.rb << FORMULA
103+
class Tgrc < Formula
104+
desc "Telegram CLI for reading messages from the terminal"
105+
homepage "https://github.com/jakshi/telegram-rust-cli"
106+
version "${version}"
107+
license "MIT"
108+
109+
on_macos do
110+
if Hardware::CPU.arm?
111+
url "https://github.com/jakshi/telegram-rust-cli/releases/download/${tag}/tgrc-arm64-apple-darwin.tar.gz"
112+
sha256 "${sha256_arm64}"
113+
else
114+
url "https://github.com/jakshi/telegram-rust-cli/releases/download/${tag}/tgrc-x86_64-apple-darwin.tar.gz"
115+
sha256 "${sha256_x86_64}"
116+
end
117+
end
118+
119+
def install
120+
bin.install "tgrc"
121+
end
122+
123+
test do
124+
assert_match "tgrc", shell_output("#{bin}/tgrc --help")
125+
end
126+
end
127+
FORMULA
128+
129+
# Remove leading spaces from heredoc
130+
sed -i 's/^ //' Formula/tgrc.rb
131+
132+
git config user.name "github-actions[bot]"
133+
git config user.email "github-actions[bot]@users.noreply.github.com"
134+
if git diff --quiet -- Formula/tgrc.rb; then
135+
echo "Homebrew tap already up to date"
136+
else
137+
git add Formula/tgrc.rb
138+
git commit -m "Update tgrc to ${version}"
139+
git push
140+
fi

‎.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/target
2+
.claude/
3+
.notes
4+
justfile.local
5+
config.toml
6+
.env
7+
.env.*
8+
!.env.example

‎.pre-commit-config.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: just-fast-check
5+
name: just fast-check
6+
entry: just fast-check
7+
language: system
8+
pass_filenames: false
9+
stages: [pre-commit]
10+
11+
- id: just-check
12+
name: just check
13+
entry: just check
14+
language: system
15+
pass_filenames: false
16+
stages: [pre-push]

‎CHANGELOG.md‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changelog
2+
3+
## v0.1.2
4+
5+
Fix: Homebrew-installed binary crashed with `dyld: Library not loaded: libtdjson`.
6+
7+
- upgrade tdlib-rs from 1.3 to 1.4 and enable the `static` feature — TDLib is now
8+
statically linked into the binary, eliminating the runtime dependency on `libtdjson.dylib`
9+
10+
## v0.1.1
11+
12+
Patch release.
13+
14+
- add the MIT `LICENSE` file and package metadata
15+
- make the release workflow tolerate reruns when the GitHub release already exists
16+
17+
## v0.1.0
18+
19+
Initial release.
20+
21+
- **auth** — login, logout (revokes server session), status
22+
- **list** — list chats with IDs (public channels, private groups, DMs)
23+
- **read** — read messages from any chat by username, chat ID, or `saved`; supports `--limit` and `--skip` for pagination
24+
- **status** — diagnostics (config path, session path, TDLib verbosity, auth state)
25+
- TOML config with flexible `api_id` (string or number), optional `[channel]` defaults
26+
- TDLib log suppression (silent by default, configurable via `tdlib_log_verbosity`)
27+
- Local timezone timestamps
28+
- GitHub Actions release workflow with Homebrew tap auto-update

0 commit comments

Comments
 (0)