Don't cache builds for PRs

Doesn't work since they don't have access to write to the registry.
This commit is contained in:
Donkie
2023-07-25 23:06:33 +02:00
parent a335b16abd
commit 7c23156d85

View File

@@ -5,7 +5,7 @@ on:
branches: branches:
- master - master
tags: tags:
- 'v*' - "v*"
pull_request: pull_request:
branches: branches:
- master - master
@@ -54,6 +54,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Spoolman - name: Build Spoolman
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
@@ -62,6 +63,16 @@ jobs:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64 cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64,mode=max cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64,mode=max
# Separate build for pull requests since PRs dont have access to store cache
- name: Build Spoolman (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ env.IMAGE_NAME }}:test
outputs: type=docker,dest=/tmp/spoolman.tar
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-amd64
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
@@ -87,6 +98,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Spoolman Tester - name: Build Spoolman Tester
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: ./tests_integration context: ./tests_integration
@@ -95,6 +107,16 @@ jobs:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester,mode=max cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester,mode=max
# Separate build for pull requests since PRs dont have access to store cache
- name: Build Spoolman Tester (PR)
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v4
with:
context: ./tests_integration
tags: ${{ env.IMAGE_NAME }}-tester:latest
outputs: type=docker,dest=/tmp/spoolman-tester.tar
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache-tester
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with: