Use env for ci ghcr_image since vars is not accessible in PRs
This commit is contained in:
39
.github/workflows/ci.yml
vendored
39
.github/workflows/ci.yml
vendored
@@ -10,6 +10,9 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
GHCR_IMAGE: donkie/spoolman
|
||||
|
||||
jobs:
|
||||
#
|
||||
# Linting
|
||||
@@ -128,10 +131,10 @@ jobs:
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
with:
|
||||
context: .
|
||||
tags: ${{ vars.GHCR_IMAGE }}:test
|
||||
tags: ${{ env.GHCR_IMAGE }}:test
|
||||
outputs: type=docker,dest=/tmp/spoolman.tar
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
|
||||
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64,mode=max
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
|
||||
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64,mode=max
|
||||
|
||||
# Separate build for pull requests since PRs dont have access to store cache
|
||||
- name: Build Spoolman (PR)
|
||||
@@ -139,9 +142,9 @@ jobs:
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
with:
|
||||
context: .
|
||||
tags: ${{ vars.GHCR_IMAGE }}:test
|
||||
tags: ${{ env.GHCR_IMAGE }}:test
|
||||
outputs: type=docker,dest=/tmp/spoolman.tar
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4.4.0
|
||||
@@ -172,10 +175,10 @@ jobs:
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
with:
|
||||
context: ./tests_integration
|
||||
tags: ${{ vars.GHCR_IMAGE }}-tester:latest
|
||||
tags: ${{ env.GHCR_IMAGE }}-tester:latest
|
||||
outputs: type=docker,dest=/tmp/spoolman-tester.tar
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester
|
||||
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester,mode=max
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester
|
||||
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester,mode=max
|
||||
|
||||
# Separate build for pull requests since PRs dont have access to store cache
|
||||
- name: Build Spoolman Tester (PR)
|
||||
@@ -183,9 +186,9 @@ jobs:
|
||||
uses: docker/build-push-action@v6.7.0
|
||||
with:
|
||||
context: ./tests_integration
|
||||
tags: ${{ vars.GHCR_IMAGE }}-tester:latest
|
||||
tags: ${{ env.GHCR_IMAGE }}-tester:latest
|
||||
outputs: type=docker,dest=/tmp/spoolman-tester.tar
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4.4.0
|
||||
@@ -259,8 +262,8 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm64
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64
|
||||
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64,mode=max
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64
|
||||
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64,mode=max
|
||||
#
|
||||
# Build arm/v7 image
|
||||
# Don't run this for pull requests
|
||||
@@ -298,8 +301,8 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm/v7
|
||||
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7
|
||||
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7,mode=max
|
||||
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7
|
||||
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7,mode=max
|
||||
#
|
||||
# Release images GHCR and Docker Hub if tests pass
|
||||
# Don't run this for pull requests
|
||||
@@ -336,7 +339,7 @@ jobs:
|
||||
uses: docker/metadata-action@v5.5.1
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/${{ vars.GHCR_IMAGE }}
|
||||
ghcr.io/${{ env.GHCR_IMAGE }}
|
||||
tags: |
|
||||
type=edge
|
||||
type=semver,pattern={{version}}
|
||||
@@ -381,9 +384,9 @@ jobs:
|
||||
GIT_COMMIT
|
||||
BUILD_DATE
|
||||
cache-from: |
|
||||
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
|
||||
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64
|
||||
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7
|
||||
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
|
||||
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64
|
||||
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7
|
||||
#
|
||||
# Create Github Release if CI was triggered by a tag
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user