@@ -2,11 +2,32 @@ name: docker-build
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - " **"
7
+ tags :
8
+ - " v*.*.*"
9
+ pull_request :
5
10
6
11
jobs :
7
12
docker :
8
13
runs-on : ubuntu-latest
9
14
steps :
15
+ - name : Docker meta
16
+ id : meta
17
+ uses : docker/metadata-action@v5
18
+ with :
19
+ # list of Docker images to use as base name for tags
20
+ images : |
21
+ anonymoussystems/torbox-tinfoil-server
22
+ ghcr.io/anonymous-org-za/torbox-tinfoil-server
23
+ # generate Docker tags based on the following events/attributes
24
+ tags : |
25
+ type=ref,event=branch
26
+ type=ref,event=pr
27
+ type=semver,pattern={{version}}
28
+ type=semver,pattern={{major}}.{{minor}}
29
+ type=semver,pattern={{major}}
30
+ type=sha
10
31
-
11
32
name : Set up QEMU
12
33
uses : docker/setup-qemu-action@v3
@@ -15,13 +36,21 @@ jobs:
15
36
uses : docker/setup-buildx-action@v3
16
37
-
17
38
name : Login to Docker Hub
39
+ if : github.event_name != 'pull_request'
18
40
uses : docker/login-action@v3
19
41
with :
20
42
username : ${{ secrets.DOCKERHUB_USERNAME }}
21
43
password : ${{ secrets.DOCKERHUB_TOKEN }}
22
- -
23
- name : Build and push
44
+ - name : Login to GHCR
45
+ if : github.event_name != 'pull_request'
46
+ uses : docker/login-action@v3
47
+ with :
48
+ registry : ghcr.io
49
+ username : ${{ github.repository_owner }}
50
+ password : ${{ secrets.GITHUB_TOKEN }}
51
+ - name : Build and push
24
52
uses : docker/build-push-action@v6
25
53
with :
26
- push : true
27
- tags : anonymoussystems/torbox-tinfoil-server:latest
54
+ push : ${{ github.event_name != 'pull_request' }}
55
+ tags : ${{ steps.meta.outputs.tags }}
56
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments