Skip to content

Commit 449911d

Browse files
ci: updates docker to use ghcr as well as automated tags
1 parent 713c6c5 commit 449911d

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

.github/workflows/docker-build.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@ name: docker-build
22

33
on:
44
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "v*.*.*"
9+
pull_request:
510

611
jobs:
712
docker:
813
runs-on: ubuntu-latest
914
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
1031
-
1132
name: Set up QEMU
1233
uses: docker/setup-qemu-action@v3
@@ -15,13 +36,21 @@ jobs:
1536
uses: docker/setup-buildx-action@v3
1637
-
1738
name: Login to Docker Hub
39+
if: github.event_name != 'pull_request'
1840
uses: docker/login-action@v3
1941
with:
2042
username: ${{ secrets.DOCKERHUB_USERNAME }}
2143
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
2452
uses: docker/build-push-action@v6
2553
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

Comments
 (0)