Skip to content

Commit e5b499f

Browse files
committed
build: Push to both docker-hub and ghcr.io
1 parent 3257f53 commit e5b499f

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,55 @@ name: docker
22

33
on:
44
push:
5-
branches: ['main']
6-
tags: ['v*']
7-
8-
env:
9-
REGISTRY: ghcr.io
10-
IMAGE_NAME: ${{ github.repository }}
5+
branches: [ 'main' ]
6+
tags: [ 'v*' ]
117

128
jobs:
139
build-and-push-main:
1410
runs-on: ubuntu-latest
11+
1512
permissions:
1613
contents: read
1714
packages: write
1815
attestations: write
1916
id-token: write
17+
2018
steps:
2119
- name: Check out the repo
2220
uses: actions/checkout@v5
21+
2322
- name: Docker meta
2423
id: meta
2524
uses: docker/metadata-action@v5
2625
with:
27-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
26+
images: |
27+
defnull/bbblb
28+
ghcr.io/defnull/bbblb
2829
tags: |
2930
type=raw,value=latest,enable={{is_default_branch}}
3031
type=ref,event=branch
3132
type=semver,pattern={{version}}
3233
type=semver,pattern={{major}}.{{minor}}
3334
type=semver,pattern={{major}}
34-
- name: Login to Image Registry
35+
36+
- name: Login to ghcr.io
3537
uses: docker/login-action@v3
3638
with:
37-
registry: ${{ env.REGISTRY }}
39+
registry: ghcr.io
3840
username: ${{ github.actor }}
3941
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Login to Docker Hub
44+
uses: docker/login-action@v3
45+
with:
46+
username: defnull
47+
password: ${{ secrets.DOCKERHUB_TOKEN }}
48+
4049
- name: Build and push
4150
uses: docker/build-push-action@v6
4251
with:
4352
context: .
4453
file: docker/Dockerfile
4554
push: true
4655
tags: ${{ steps.meta.outputs.tags }}
47-
labels: ${{ steps.meta.outputs.labels }}
56+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)