@@ -2,45 +2,38 @@ name: Publish image
2
2
on :
3
3
push :
4
4
branches : [ master ]
5
+ env :
6
+ REGISTRY : ghcr.io
7
+ IMAGE_NAME : ${{ github.repository }}
5
8
6
9
jobs :
7
- push_to_registries :
8
- name : Push Docker image to multiple registries
10
+ build-and-push-image :
9
11
runs-on : ubuntu-latest
10
12
permissions :
11
- packages : write
12
13
contents : read
14
+ packages : write
15
+
13
16
steps :
14
- - name : Check out the repo
17
+ - name : Checkout repository
15
18
uses : actions/checkout@v3
16
19
17
- # - name: Log in to Docker Hub
18
- # uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
19
- # with:
20
- # username: ${{ secrets.DOCKER_USERNAME }}
21
- # password: ${{ secrets.DOCKER_PASSWORD }}
22
-
23
20
- name : Log in to the Container registry
24
21
uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
25
22
with :
26
- registry : ghcr.io
23
+ registry : ${{ env.REGISTRY }}
27
24
username : ${{ github.actor }}
28
25
password : ${{ secrets.GITHUB_TOKEN }}
29
26
30
27
- name : Extract metadata (tags, labels) for Docker
31
28
id : meta
32
29
uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
33
30
with :
34
- images : |
35
- my-docker-hub-namespace/my-docker-hub-repository
36
- ghcr.io/${{ github.repository }}
31
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37
32
38
- - name : Build and push Docker images
33
+ - name : Build and push Docker image
39
34
uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
40
35
with :
41
36
context : .
42
37
push : true
43
38
tags : ${{ steps.meta.outputs.tags }}
44
39
labels : ${{ steps.meta.outputs.labels }}
45
-
46
-
0 commit comments