@@ -2,41 +2,34 @@ name: Create and publish a Docker image
2
2
3
3
on :
4
4
push :
5
- tags :
6
- - ' *'
7
-
8
- env :
9
- REGISTRY : ghcr.io
10
- IMAGE_NAME : ${{ github.repository }}
5
+ branches : ["master"]
11
6
12
7
jobs :
13
- build-and-push-image :
8
+ push_to_registry :
9
+ name : Push Docker image to Docker Hub
10
+ environment : production
14
11
runs-on : ubuntu-latest
15
- permissions :
16
- contents : read
17
- packages : write
18
-
19
12
steps :
20
- - name : Checkout repository
21
- uses : actions/checkout@v3
13
+ - name : Check out the repo
14
+ uses : actions/checkout@v4
22
15
23
- - name : Log in to the Container registry
24
- uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
16
+ - name : Login to Docker Hub
17
+ uses : docker/login-action@v3.0.0
25
18
with :
26
- registry : ${{ env.REGISTRY }}
27
- username : ${{ github.actor }}
28
- password : ${{ secrets.GITHUB_TOKEN }}
19
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
20
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
29
21
30
22
- name : Extract metadata (tags, labels) for Docker
31
23
id : meta
32
- uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
24
+ uses : docker/metadata-action@v5.5.1
33
25
with :
34
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
26
+ images : dedicatus545/github-cors-server
35
27
36
28
- name : Build and push Docker image
37
- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
29
+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
38
30
with :
39
31
context : .
32
+ file : ./Dockerfile
40
33
push : true
41
34
tags : ${{ steps.meta.outputs.tags }}
42
35
labels : ${{ steps.meta.outputs.labels }}
0 commit comments