1
+ name : Create Release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' v*'
7
+
8
+ jobs :
9
+ create-release :
10
+ runs-on : ubuntu-latest
11
+ permissions :
12
+ contents : write
13
+ packages : read
14
+
15
+ steps :
16
+ - name : Checkout code
17
+ uses : actions/checkout@v4
18
+ with :
19
+ fetch-depth : 0
20
+
21
+ - name : Get the version
22
+ id : get_version
23
+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
24
+
25
+ - name : Get previous tag
26
+ id : prev_tag
27
+ run : |
28
+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
29
+ echo "PREV_TAG=${PREV_TAG}" >> $GITHUB_OUTPUT
30
+
31
+ - name : Generate changelog
32
+ id : changelog
33
+ run : |
34
+ if [ -z "${{ steps.prev_tag.outputs.PREV_TAG }}" ]; then
35
+ CHANGELOG=$(git log --pretty=format:"- %s (%h)" HEAD)
36
+ else
37
+ CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ steps.prev_tag.outputs.PREV_TAG }}..HEAD)
38
+ fi
39
+ echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
40
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
41
+ echo "EOF" >> $GITHUB_OUTPUT
42
+
43
+ - name : Wait for Docker build
44
+ run : |
45
+ echo "Waiting for Docker image to be built..."
46
+ sleep 30
47
+
48
+ - name : Create Release
49
+ uses : actions/create-release@v1
50
+ env :
51
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52
+ with :
53
+ tag_name : ${{ steps.get_version.outputs.VERSION }}
54
+ release_name : Release ${{ steps.get_version.outputs.VERSION }}
55
+ body : |
56
+ ## Changes in this Release
57
+
58
+ ${{ steps.changelog.outputs.CHANGELOG }}
59
+
60
+ ## Docker Image
61
+
62
+ Pull the Docker image for this release:
63
+ ```bash
64
+ docker pull ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
65
+ ```
66
+
67
+ Or use the latest tag:
68
+ ```bash
69
+ docker pull ghcr.io/${{ github.repository }}:latest
70
+ ```
71
+
72
+ ## What's Changed
73
+ **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.PREV_TAG }}...${{ steps.get_version.outputs.VERSION }}
74
+ draft : false
75
+ prerelease : ${{ contains(steps.get_version.outputs.VERSION, '-rc') || contains(steps.get_version.outputs.VERSION, '-beta') || contains(steps.get_version.outputs.VERSION, '-alpha') }}
0 commit comments