1
+ name : release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " v*"
7
+
8
+ jobs :
9
+ release :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout
13
+ uses : actions/checkout@v2
14
+
15
+ - name : Prepare
16
+ id : prepare
17
+ run : |
18
+ git fetch --prune --unshallow --tags
19
+
20
+ VERSION=$(git tag --points-at HEAD)
21
+ VERSION=${VERSION//v}
22
+ IMAGE_NAME=${GITHUB_REPOSITORY#*/}
23
+ IMAGE_NAME="${{ secrets.DOCKERHUB_USER }}/${IMAGE_NAME//docker-}"
24
+ IMAGE_TAGS="${IMAGE_NAME}:latest,${IMAGE_NAME}:${VERSION}"
25
+
26
+ echo "## :bookmark_tabs: Changes" >>"CHANGELOG.md"
27
+ git log --pretty=format:"- %s %H%n" $(git describe --abbrev=0 --tags $(git describe --tags --abbrev=0)^)...$(git describe --tags --abbrev=0) >>"CHANGELOG.md"
28
+
29
+ echo ::set-output name=image_tags::${IMAGE_TAGS}
30
+ echo ::set-output name=version::${VERSION}
31
+ echo ::set-output name=changelog::${CHANGELOG}
32
+
33
+ - name : Set up QEMU
34
+ uses : docker/setup-qemu-action@v1
35
+ with :
36
+ platforms : linux/arm/v6,linux/arm/v7,linux/arm64
37
+
38
+ - name : Set up Docker Buildx
39
+ uses : docker/setup-buildx-action@v1
40
+
41
+ - name : Login to DockerHub
42
+ uses : docker/login-action@v1
43
+ with :
44
+ username : ${{ secrets.DOCKERHUB_USER }}
45
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
46
+
47
+ - name : Build and Push
48
+ uses : docker/build-push-action@v2
49
+ with :
50
+ push : true
51
+ tags : ${{ steps.prepare.outputs.image_tags }}
52
+
53
+ - name : Create Release
54
+ uses : actions/create-release@v1
55
+ env :
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
+ with :
58
+ tag_name : ${{ github.ref }}
59
+ release_name : Release ${{ steps.prepare.outputs.version }}
60
+ body_path : CHANGELOG.md
61
+ draft : false
62
+ prerelease : false
0 commit comments