1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+
6
+ # GitHub recommends pinning actions to a commit SHA.
7
+ # To get a newer version, you will need to update the SHA.
8
+ # You can also reference a tag or branch, but the action may change without warning.
9
+
10
+ name : Publish Docker image
11
+
12
+ on :
13
+ workflow_dispatch :
14
+ release :
15
+ types : [published]
16
+
17
+ jobs :
18
+ push_to_registries :
19
+ name : Push image to
20
+ runs-on : ubuntu-latest
21
+ permissions :
22
+ packages : write
23
+ contents : read
24
+ steps :
25
+ - name : Check out the repo
26
+ uses : actions/checkout@v4
27
+
28
+ - name : Log in to Docker Hub
29
+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
30
+ with :
31
+ username : ${{ secrets.DOCKER_USERNAME }}
32
+ password : ${{ secrets.DOCKER_PASSWORD }}
33
+
34
+ - name : Log in to the Container registry
35
+ uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
36
+ with :
37
+ registry : ghcr.io
38
+ username : ${{ github.actor }}
39
+ password : ${{ secrets.GITHUB_TOKEN }}
40
+
41
+ - name : Extract metadata (tags, labels) for Docker
42
+ id : meta
43
+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
44
+ with :
45
+ images : |
46
+ ${{ github.repository }}
47
+ ghcr.io/${{ github.repository }}
48
+
49
+ - name : Build and push Docker images
50
+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
51
+ with :
52
+ context : .
53
+ push : true
54
+ tags : ${{ steps.meta.outputs.tags }}
55
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments