Skip to content

Commit 3730f09

Browse files
authored
feat: publish release to ghcr.io (#12)
* feat: publish release to ghcr.io * dependency: update gh action dependencies
1 parent 3ab5e89 commit 3730f09

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed
Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,62 @@
11
name: Build multi-arch Docker Image
22

33
on:
4+
release:
5+
types: [published]
46
push:
57
branches: [main]
68
pull_request:
79

10+
env:
11+
IMAGE_REPOSITORY: testcontainers/vnc-recorder
12+
813
jobs:
914
build:
1015
runs-on: ubuntu-latest
1116
steps:
12-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
18+
19+
- name: Login to Docker Hub
20+
# Only if we need to push an image
21+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
22+
uses: docker/login-action@v3
23+
with:
24+
username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
password: ${{ secrets.DOCKERHUB_TOKEN }}
1326

27+
- name: Login to Github Container Registry
28+
# Only if we need to push an image
29+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# Setup for buildx
1437
- name: Set up QEMU
15-
uses: docker/setup-qemu-action@v2
38+
uses: docker/setup-qemu-action@v3
39+
1640
- name: Set up Docker Buildx
1741
id: buildx
18-
uses: docker/setup-buildx-action@v2
42+
uses: docker/setup-buildx-action@v3
1943

44+
# Debugging information
2045
- name: Docker info
2146
run: docker info
47+
2248
- name: Buildx inspect
2349
run: docker buildx inspect
2450

51+
# Build and (optionally) push the image
2552
- name: Build image
26-
uses: docker/build-push-action@v3
53+
uses: docker/build-push-action@v6
2754
with:
2855
context: .
2956
file: ./Dockerfile
3057
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
31-
push: false
58+
push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
3259
# Use a 'temp' tag, that won't be pushed, for non-release builds
33-
tags: testcontainers/vnc-recorder:${{ github.event.release.tag_name || 'temp' }}
60+
tags: |
61+
${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'temp' }}
62+
ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ github.event.release.tag_name || 'temp' }}

0 commit comments

Comments
 (0)