Skip to content

Commit 3a97761

Browse files
committed
Fix issue and upload Docker images as artifacts
This fixes an issue caused by trying to cache to Docker Hub on pull requests
1 parent 2584eed commit 3a97761

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/docker.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,33 @@ jobs:
3232
uses: docker/setup-buildx-action@v2
3333

3434
- name: Build and push
35+
if: github.event_name == 'push'
3536
uses: docker/build-push-action@v3
3637
with:
3738
context: ./docker/
3839
file: ./docker/Dockerfile
3940
platforms: linux/amd64,linux/arm64
4041
builder: ${{ steps.buildx.outputs.name }}
41-
push: ${{ github.event_name == 'push' }}
42+
push: true
4243
tags: ${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:latest
4344
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache
4445
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max
46+
outputs: type=docker,dest=/tmp/infinitime-build.tar
47+
48+
- name: Build
49+
if: github.event_name != 'push'
50+
uses: docker/build-push-action@v3
51+
with:
52+
context: ./docker/
53+
file: ./docker/Dockerfile
54+
platforms: linux/amd64,linux/arm64
55+
builder: ${{ steps.buildx.outputs.name }}
56+
push: false
57+
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME || env.USERNAME }}/infinitime-build:buildcache
58+
outputs: type=docker,dest=/tmp/infinitime-build.tar
59+
60+
- name: Upload Docker image
61+
uses: actions/upload-artifacts@v3
62+
with:
63+
name: Docker image
64+
path: /tmp/infinitime-build.tar

0 commit comments

Comments
 (0)