Skip to content

Commit 098afc9

Browse files
committed
ci: improve flow
1 parent c029d1a commit 098afc9

4 files changed

Lines changed: 65 additions & 24 deletions

File tree

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- build
7+
tags:
8+
- '*'
79
release:
810
types: [published]
911

@@ -48,31 +50,34 @@ jobs:
4850
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/tdlib-buildcache
4951
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/tdlib-buildcache,mode=max
5052

51-
release-push:
52-
if: github.event_name == 'release' && github.event.action == 'published'
53+
create-release:
54+
if: startsWith(github.ref, 'refs/tags/')
5355
runs-on: ubuntu-latest
5456
steps:
55-
- name: Checkout code
57+
- name: Checkout full history
5658
uses: actions/checkout@v4
57-
58-
- name: Set up QEMU
59-
uses: docker/setup-qemu-action@v3
60-
61-
- name: Set up Docker Buildx
62-
uses: docker/setup-buildx-action@v3
63-
64-
- name: Log in to Docker Hub
65-
uses: docker/login-action@v3
6659
with:
67-
username: ${{ vars.DOCKERHUB_USERNAME }}
68-
password: ${{ secrets.DOCKERHUB_TOKEN }}
60+
fetch-depth: 0
6961

70-
- name: Build and Push Release Tag
71-
uses: docker/build-push-action@v5
62+
- name: Compute commit summary
63+
id: get_changes
64+
run: |
65+
TAG=${GITHUB_REF#refs/tags/}
66+
echo "Current tag: $TAG"
67+
git fetch --tags
68+
PREV_TAG=$(git describe --tags --abbrev=0 "$TAG"^ 2>/dev/null || git tag --sort=-creatordate | grep -v "^$TAG$" | head -n1 || true)
69+
if [ -n "$PREV_TAG" ]; then RANGE="$PREV_TAG..$TAG"; else RANGE="$TAG"; fi
70+
BODY=$(git log "$RANGE" --pretty=format:'- %s (%h) — %an')
71+
if [ -z "$BODY" ]; then BODY="No changes recorded."; fi
72+
echo "body<<EOF" >> $GITHUB_OUTPUT
73+
echo "$BODY" >> $GITHUB_OUTPUT
74+
echo "EOF" >> $GITHUB_OUTPUT
75+
76+
- name: Create GitHub Release
77+
uses: actions/create-release@v1
7278
with:
73-
context: .
74-
file: Dockerfile
75-
platforms: linux/amd64,linux/arm64
76-
push: true
77-
tags: |
78-
lazyskyline/tdlib:${{ github.event.release.tag_name }}
79+
tag_name: ${{ github.ref_name }}
80+
release_name: ${{ github.ref_name }}
81+
body: ${{ steps.get_changes.outputs.body }}
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Promote release to latest (manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'The release tag to promote'
8+
required: true
9+
10+
jobs:
11+
promote:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Log in to Docker Hub
18+
uses: docker/login-action@v3
19+
with:
20+
registry: docker.io
21+
username: ${{ vars.DOCKERHUB_USERNAME }}
22+
password: ${{ secrets.DOCKERHUB_TOKEN }}
23+
24+
- name: Pull release image
25+
run: |
26+
IMAGE=lazyskyline/tdlib:${{ inputs.release_tag }}
27+
echo "Pulling $IMAGE"
28+
docker pull "$IMAGE"
29+
30+
- name: Tag as latest and push
31+
run: |
32+
RELEASE_IMAGE=lazyskyline/tdlib:${{ inputs.release_tag }}
33+
LATEST_IMAGE=lazyskyline/tdlib:latest
34+
echo "Tagging $RELEASE_IMAGE -> $LATEST_IMAGE"
35+
docker tag "$RELEASE_IMAGE" "$LATEST_IMAGE"
36+
docker push "$LATEST_IMAGE"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive
66
# Install build dependencies
77
RUN apt-get update && \
88
apt-get install -y --no-install-recommends \
9-
make zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev && \
9+
make zlib1g-dev libssl-dev gperf php-cli cmake clang libc++-dev libc++abi-dev libclang-rt-14-dev && \
1010
rm -rf /var/lib/apt/lists/*
1111

1212
# Copy the source code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TDLib Docker Image
22

33
[![Docker Pulls](https://img.shields.io/docker/pulls/lazyskyline/tdlib)](https://hub.docker.com/repository/docker/lazyskyline/tdlib)
4-
[![Deployment](https://github.com/lancehsu/tdlib-docker-build/actions/workflows/docker-image.yml/badge.svg)](https://github.com/lancehsu/tdlib-docker-build/actions/workflows/docker-image.yml)
4+
[![Deployment](https://github.com/lancehsu/tdlib-docker-build/actions/workflows/build-and-push.yml/badge.svg)](https://github.com/lancehsu/tdlib-docker-build/actions/workflows/build-and-push.yml)
55

66
This repository provides a Docker image for [TDLib (Telegram Database Library)](https://core.telegram.org/tdlib), enabling easy and reproducible builds and deployments of TDLib in containerized environments.
77

0 commit comments

Comments
 (0)