File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-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
+ - ' main'
7
+ tags :
8
+ - ' v*'
9
+ pull_request :
10
+ branches :
11
+ - ' main'
12
+
13
+ env :
14
+ REGISTRY : ghcr.io
15
+ IMAGE_NAME : ${{ github.repository }}
16
+
17
+ jobs :
18
+ build-and-push-container :
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 : Extract metadata (tags, labels) for Docker
29
+ id : meta
30
+ uses : docker/metadata-action@v3
31
+ with :
32
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33
+
34
+ - name : Log in to the Container registry
35
+ if : github.event_name != 'pull_request'
36
+ uses : docker/login-action@v1
37
+ with :
38
+ registry : ${{ env.REGISTRY }}
39
+ username : ${{ github.actor }}
40
+ password : ${{ secrets.GITHUB_TOKEN }}
41
+
42
+ - name : Build and push Docker image
43
+ uses : docker/build-push-action@v2
44
+ with :
45
+ context : .
46
+ push : ${{ github.event_name != 'pull_request' }}
47
+ tags : ${{ steps.meta.outputs.tags }}
48
+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments