@@ -2,6 +2,8 @@ name: Test and Publish
2
2
3
3
on :
4
4
push :
5
+ branches : [ 'main' ] # Triger on the main branch
6
+ tags : [ '[0-9]+.[0-9]+.[0-9]+' ] # Trigger on version tags like '0.1.0'
5
7
6
8
jobs :
7
9
tests :
@@ -22,26 +24,38 @@ jobs:
22
24
run : docker compose run ssp-sp1.local ./run-metadata-tests.sh
23
25
24
26
build-and-publish :
25
- name : Build and Publish
27
+ name : Build and Publish Docker image
26
28
needs : tests
27
29
runs-on : ubuntu-latest
28
30
steps :
29
31
- name : Checkout code
30
32
uses : actions/checkout@v4
33
+
31
34
- name : Log in to Docker Hub
32
35
uses : docker/login-action@v3
33
36
with :
34
37
username : ${{ secrets.DOCKERHUB_USERNAME }}
35
38
password : ${{ secrets.DOCKERHUB_TOKEN }}
39
+
40
+ - name : Log in to GitHub Container Registry
41
+ uses : docker/login-action@v3
42
+ with :
43
+ registry : ghcr.io
44
+ username : ${{ github.actor }}
45
+ password : ${{ secrets.GITHUB_TOKEN }}
46
+
36
47
- name : Extract metadata (tags, labels) for Docker
37
48
id : meta
38
49
uses : docker/metadata-action@v5
39
50
with :
40
- images : ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}
51
+ images : |
52
+ ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}
53
+ ghcr.io/${{ github.repository }}
41
54
tags : |
42
55
type=ref,event=branch
43
56
type=semver,pattern={{version}}
44
57
type=semver,pattern={{major}}.{{minor}}
58
+
45
59
- name : Build and push Docker image
46
60
uses : docker/build-push-action@v5
47
61
with :
0 commit comments