1
+ name : Build And Push
2
+
3
+ on :
4
+ pull_request :
5
+ types :
6
+ - closed
7
+
8
+ env :
9
+ IMAGE_NAME : example-application-project
10
+ CLASSPATH_DIRECTORY_NAME : .activiti/project-release-volume
11
+ ARG_VERSION : 1
12
+
13
+
14
+ jobs :
15
+ build-image :
16
+ runs-on : ubuntu-latest
17
+ permissions :
18
+ actions : read
19
+ contents : read
20
+ packages : write
21
+ security-events : write
22
+ outputs :
23
+ do_release : ${{ steps.release_guard.outputs.do_release }}
24
+ VERSION : ${{ steps.fetch_version.outputs.VERSION }}
25
+ steps :
26
+ - name : Check out the repo
27
+ uses : actions/checkout@v3
28
+ with :
29
+ fetch-depth : 0
30
+ ref : master
31
+ token : ${{ secrets.BOT_GITHUB_TOKEN }}
32
+
33
+ - name : Fetch next version
34
+ id : fetch_version
35
+ run : |
36
+ echo "VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT
37
+
38
+ - name : Check if release is necessary
39
+ id : release_guard
40
+ run : |
41
+ if git tag | grep -q "^${{steps.fetch_version.outputs.VERSION}}$"; then
42
+ echo "do_release=false" >> $GITHUB_OUTPUT
43
+ else
44
+ echo "do_release=true" >> $GITHUB_OUTPUT
45
+ fi
46
+
47
+ - name : Set up QEMU
48
+ uses : docker/setup-qemu-action@v2
49
+
50
+ - name : Set up Docker Buildx
51
+ uses : docker/setup-buildx-action@v2
52
+ with :
53
+ version : v0.11.0
54
+ # apply fix from https://github.com/moby/buildkit/issues/3969
55
+ driver-opts : |
56
+ image=moby/buildkit:v0.11.6
57
+ network=host
58
+
59
+ - name : Login to docker.io
60
+ uses : docker/login-action@v2
61
+ with :
62
+ username : ${{ secrets.DOCKER_USERNAME }}
63
+ password : ${{ secrets.DOCKER_PASSWORD }}
64
+
65
+ - name : Login to ghcr.io
66
+ uses : docker/login-action@v2
67
+ with :
68
+ registry : ghcr.io
69
+ username : ${{ github.actor }}
70
+ password : ${{ secrets.GITHUB_TOKEN }}
71
+
72
+ - name : Build image ${{ env.IMAGE_NAME }}
73
+ if : steps.release_guard.outputs.do_release == 'true'
74
+ uses : docker/build-push-action@v4
75
+ with :
76
+ context : ./example-application-project
77
+ tags : ghcr.io/alfresco/example-process-application:${{ steps.fetch_version.outputs.VERSION }}
78
+ push : true
79
+ build-args : |
80
+ CLASSPATH_DIRECTORY_NAME=${{env.CLASSPATH_DIRECTORY_NAME}}
81
+ VERSION=${{env.ARG_VERSION}}
82
+
83
+ release-notes :
84
+ name : Release Notes
85
+ needs : build-image
86
+ runs-on : ubuntu-latest
87
+ steps :
88
+ - name : Check out the repo
89
+ uses : actions/checkout@v3
90
+ with :
91
+ fetch-depth : 0
92
+ ref : master
93
+ token : ${{ secrets.BOT_GITHUB_TOKEN }}
94
+
95
+ - name : Generate release notes
96
+ if : needs.build-image.outputs.do_release == 'true'
97
+ env :
98
+ GH_TOKEN : ${{ secrets.BOT_GITHUB_TOKEN }}
99
+ run : gh release create "${{needs.build-image.outputs.VERSION}}" --generate-notes -t "${{needs.build-image.outputs.VERSION}}"
0 commit comments