Skip to content

Commit cdc2457

Browse files
committed
ci: build + push to ghcr.io/ankuper/telegram-bot-api with GHA layer cache
- trigger: push/PR to teleproto3-support + workflow_dispatch - jobs: identity-audit → lint → build-push - GHCR push only on teleproto3-support branch (PR builds but doesn't push) - tags: latest + short sha - cache-from/to: type=gha (keeps TDLib layers across runs)
1 parent 55603b1 commit cdc2457

1 file changed

Lines changed: 42 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: ci
2+
23
on:
34
push:
4-
branches: [main]
5+
branches: [teleproto3-support]
56
pull_request:
7+
branches: [teleproto3-support]
68
workflow_dispatch:
79

10+
permissions:
11+
contents: read
12+
packages: write # needed for ghcr.io push
13+
814
jobs:
915
identity-audit:
1016
runs-on: ubuntu-latest
@@ -14,7 +20,6 @@ jobs:
1420
fetch-depth: 0
1521
- name: Identity hygiene gate
1622
env:
17-
# provide the real-name denylist as a secret; never commit it
1823
IDENTITY_DENYLIST: ${{ secrets.IDENTITY_DENYLIST }}
1924
run: |
2025
if [ -n "${IDENTITY_DENYLIST:-}" ]; then
@@ -31,11 +36,42 @@ jobs:
3136
sudo apt-get update && sudo apt-get install -y shellcheck
3237
shellcheck entrypoint.sh ci/*.sh
3338
34-
build:
39+
build-push:
3540
needs: [identity-audit, lint]
3641
runs-on: ubuntu-latest
3742
steps:
3843
- uses: actions/checkout@v4
39-
- name: Build image
40-
run: docker build -t telegram-bot-api-type3:ci .
41-
# smoke runs only where a proxy endpoint + bot token are available (self-hosted runner)
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Log in to GHCR
49+
uses: docker/login-action@v3
50+
with:
51+
registry: ghcr.io
52+
username: ${{ github.actor }}
53+
password: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Docker metadata (tags + labels)
56+
id: meta
57+
uses: docker/metadata-action@v5
58+
with:
59+
images: ghcr.io/ankuper/telegram-bot-api
60+
tags: |
61+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/teleproto3-support' }}
62+
type=sha,prefix=,format=short
63+
64+
- name: Build and push
65+
uses: docker/build-push-action@v5
66+
with:
67+
context: .
68+
push: ${{ github.ref == 'refs/heads/teleproto3-support' }}
69+
tags: ${{ steps.meta.outputs.tags }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
# GHA cache keeps TDLib build layers across runs — critical, build takes 30-60 min
72+
cache-from: type=gha
73+
cache-to: type=gha,mode=max
74+
build-args: |
75+
TELEPROTO3_REF=main
76+
TDLIB_REF=teleproto3-support
77+
BOT_API_REF=master

0 commit comments

Comments
 (0)