Skip to content

Commit e6c30da

Browse files
committed
Iterate on GH Actions workflow
1 parent aa75929 commit e6c30da

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/build.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,38 @@ jobs:
2828
username: ${{ secrets.DOCKER_USERNAME }}
2929
password: ${{ secrets.DOCKER_PASSWORD }}
3030

31+
- name: Log in to GHCR
32+
run: |
33+
echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
3137
- name: publish-latest
3238
run: |
33-
docker tag contentful-labs/coredns-nodecache:latest contentful/latest
39+
# Dockerhub
40+
docker tag contentful-labs/coredns-nodecache:latest contentful/coredns-nodecache:latest
3441
docker push contentful/coredns-nodecache:latest
42+
# GHCR
43+
docker tag contentful-labs/coredns-nodecache:latest ghcr.io/contentful-labs/coredns-nodecache:latest
44+
docker push ghcr.io/contentful-labs/coredns-nodecache:latest
3545
if: github.ref == 'refs/heads/master'
3646

3747
- name: publish-branch
3848
run: |
49+
# Dockerhub
3950
docker tag contentful-labs/coredns-nodecache:latest contentful/coredns-nodecache:${GITHUB_REF##*/}
4051
docker push contentful/coredns-nodecache:${GITHUB_REF##*/}
52+
# GHCR
53+
docker tag contentful-labs/coredns-nodecache:latest ghcr.io/contentful-labs/coredns-nodecache:${GITHUB_REF##*/}
54+
docker push ghcr.io/contentful-labs/coredns-nodecache:${GITHUB_REF##*/}
4155
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/master'
4256

4357
- name: publish-tag
4458
run: |
59+
# Dockerhub
4560
docker tag contentful-labs/coredns-nodecache:latest contentful/coredns-nodecache:${GITHUB_REF##*/}
4661
docker push contentful/coredns-nodecache:${GITHUB_REF##*/}
62+
# GHCR
63+
docker tag contentful-labs/coredns-nodecache:latest ghcr.io/contentful-labs/coredns-nodecache:${GITHUB_REF##*/}
64+
docker push ghcr.io/contentful-labs/coredns-nodecache:${GITHUB_REF##*/}
4765
if: startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)