|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - build |
| 7 | + tags: |
| 8 | + - '*' |
7 | 9 | release: |
8 | 10 | types: [published] |
9 | 11 |
|
@@ -48,31 +50,34 @@ jobs: |
48 | 50 | cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/tdlib-buildcache |
49 | 51 | cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/tdlib-buildcache,mode=max |
50 | 52 |
|
51 | | - release-push: |
52 | | - if: github.event_name == 'release' && github.event.action == 'published' |
| 53 | + create-release: |
| 54 | + if: startsWith(github.ref, 'refs/tags/') |
53 | 55 | runs-on: ubuntu-latest |
54 | 56 | steps: |
55 | | - - name: Checkout code |
| 57 | + - name: Checkout full history |
56 | 58 | 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 |
66 | 59 | with: |
67 | | - username: ${{ vars.DOCKERHUB_USERNAME }} |
68 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 60 | + fetch-depth: 0 |
69 | 61 |
|
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 |
72 | 78 | 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 }} |
0 commit comments