Skip to content

Commit 11a74e2

Browse files
committed
Use env for ci ghcr_image since vars is not accessible in PRs
1 parent ec51730 commit 11a74e2

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

.github/workflows/ci.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches:
1111
- master
1212

13+
env:
14+
GHCR_IMAGE: donkie/spoolman
15+
1316
jobs:
1417
#
1518
# Linting
@@ -128,20 +131,20 @@ jobs:
128131
uses: docker/[email protected]
129132
with:
130133
context: .
131-
tags: ${{ vars.GHCR_IMAGE }}:test
134+
tags: ${{ env.GHCR_IMAGE }}:test
132135
outputs: type=docker,dest=/tmp/spoolman.tar
133-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
134-
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64,mode=max
136+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
137+
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64,mode=max
135138

136139
# Separate build for pull requests since PRs dont have access to store cache
137140
- name: Build Spoolman (PR)
138141
if: ${{ github.event_name == 'pull_request' }}
139142
uses: docker/[email protected]
140143
with:
141144
context: .
142-
tags: ${{ vars.GHCR_IMAGE }}:test
145+
tags: ${{ env.GHCR_IMAGE }}:test
143146
outputs: type=docker,dest=/tmp/spoolman.tar
144-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
147+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
145148

146149
- name: Upload artifact
147150
uses: actions/[email protected]
@@ -172,20 +175,20 @@ jobs:
172175
uses: docker/[email protected]
173176
with:
174177
context: ./tests_integration
175-
tags: ${{ vars.GHCR_IMAGE }}-tester:latest
178+
tags: ${{ env.GHCR_IMAGE }}-tester:latest
176179
outputs: type=docker,dest=/tmp/spoolman-tester.tar
177-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester
178-
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester,mode=max
180+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester
181+
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester,mode=max
179182

180183
# Separate build for pull requests since PRs dont have access to store cache
181184
- name: Build Spoolman Tester (PR)
182185
if: ${{ github.event_name == 'pull_request' }}
183186
uses: docker/[email protected]
184187
with:
185188
context: ./tests_integration
186-
tags: ${{ vars.GHCR_IMAGE }}-tester:latest
189+
tags: ${{ env.GHCR_IMAGE }}-tester:latest
187190
outputs: type=docker,dest=/tmp/spoolman-tester.tar
188-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-tester
191+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-tester
189192

190193
- name: Upload artifact
191194
uses: actions/[email protected]
@@ -259,8 +262,8 @@ jobs:
259262
with:
260263
context: .
261264
platforms: linux/arm64
262-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64
263-
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64,mode=max
265+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64
266+
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64,mode=max
264267
#
265268
# Build arm/v7 image
266269
# Don't run this for pull requests
@@ -298,8 +301,8 @@ jobs:
298301
with:
299302
context: .
300303
platforms: linux/arm/v7
301-
cache-from: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7
302-
cache-to: type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7,mode=max
304+
cache-from: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7
305+
cache-to: type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7,mode=max
303306
#
304307
# Release images GHCR and Docker Hub if tests pass
305308
# Don't run this for pull requests
@@ -336,7 +339,7 @@ jobs:
336339
uses: docker/[email protected]
337340
with:
338341
images: |
339-
ghcr.io/${{ vars.GHCR_IMAGE }}
342+
ghcr.io/${{ env.GHCR_IMAGE }}
340343
tags: |
341344
type=edge
342345
type=semver,pattern={{version}}
@@ -381,9 +384,9 @@ jobs:
381384
GIT_COMMIT
382385
BUILD_DATE
383386
cache-from: |
384-
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-amd64
385-
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-arm64
386-
type=registry,ref=ghcr.io/${{ vars.GHCR_IMAGE }}:buildcache-armv7
387+
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-amd64
388+
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-arm64
389+
type=registry,ref=ghcr.io/${{ env.GHCR_IMAGE }}:buildcache-armv7
387390
#
388391
# Create Github Release if CI was triggered by a tag
389392
#

0 commit comments

Comments
 (0)