File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Create and publish a Docker image
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' master'
7
+ tags :
8
+ - ' v*'
9
+ pull_request :
10
+ branches :
11
+ - ' master'
12
+
13
+ env :
14
+ REGISTRY : ghcr.io
15
+ IMAGE_NAME : ${{ github.repository }}
16
+
17
+ jobs :
18
+ build-and-push-image :
19
+ runs-on : ubuntu-latest
20
+ permissions :
21
+ contents : read
22
+ packages : write
23
+
24
+ steps :
25
+ - name : Checkout repository
26
+ uses : actions/checkout@v3
27
+
28
+ - name : Log in to the Container registry
29
+ uses : docker/login-action@v2
30
+ with :
31
+ registry : ${{ env.REGISTRY }}
32
+ username : ${{ github.actor }}
33
+ password : ${{ secrets.GITHUB_TOKEN }}
34
+
35
+ - name : Extract metadata (tags, labels) for Docker
36
+ id : meta
37
+ uses : docker/metadata-action@v4
38
+ with :
39
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40
+
41
+ - name : Build and push Docker image
42
+ uses : docker/build-push-action@v4
43
+ with :
44
+ context : .
45
+ push : ${{ github.event_name != 'pull_request' }}
46
+ tags : ${{ steps.meta.outputs.tags }}
47
+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments