6060 restore-keys : |
6161 ${{ runner.os }}-${{ env.cache-name }}-
6262
63- - name : Cache Self hosted
64- id : cache-self-hosted
65- uses : actions/cache@v4
66- env :
67- cache-name : ${{ github.repository }}-self-hosted
68- with :
69- path : |
70- self-hosted-runtime.tar
71- self-hosted.tar
72- key : ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
73-
7463 - name : Load requirements from cache
7564 if : ${{ steps.cache-requirements.outputs.cache-hit == 'true' && inputs.cache_requirements }}
7665 run : |
@@ -81,17 +70,37 @@ jobs:
8170 run : |
8271 make build.requirements
8372
73+ # A later call in the same run reuses the image uploaded here.
74+ # Merged release PRs get a read-only cache token, so this cannot be a cache.
75+ - name : Download image built earlier in this run
76+ id : download-self-hosted
77+ uses : actions/download-artifact@v4
78+ continue-on-error : true
79+ with :
80+ name : self-hosted-image
81+
8482 - name : Load built image
85- if : ${{ steps.cache -self-hosted.outputs.cache-hit == 'true ' }}
83+ if : ${{ steps.download -self-hosted.outcome == 'success ' }}
8684 run : |
8785 make load.self-hosted
8886
8987 - name : Build self hosted
90- if : ${{ steps.cache -self-hosted.outputs.cache-hit != 'true ' }}
88+ if : ${{ steps.download -self-hosted.outcome != 'success ' }}
9189 run : |
9290 make build.self-hosted
9391 make save.self-hosted
9492
93+ - name : Upload self hosted image
94+ if : ${{ steps.download-self-hosted.outcome != 'success' }}
95+ uses : actions/upload-artifact@v4
96+ with :
97+ name : self-hosted-image
98+ path : self-hosted.tar
99+ retention-days : 1
100+ compression-level : 0
101+ if-no-files-found : error
102+ overwrite : true
103+
95104 self-hosted :
96105 name : Push Self Hosted Image
97106 needs : [build-self-hosted]
@@ -104,16 +113,10 @@ jobs:
104113 with :
105114 fetch-depth : 0
106115 submodules : ' recursive'
107- - name : Cache Self hosted
108- id : cache-self-hosted
109- uses : actions/cache@v4
110- env :
111- cache-name : ${{ github.repository }}-self-hosted
116+ - name : Download self hosted image
117+ uses : actions/download-artifact@v4
112118 with :
113- path : |
114- self-hosted-runtime.tar
115- self-hosted.tar
116- key : ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
119+ name : self-hosted-image
117120 - name : Load built image
118121 run : |
119122 make load.self-hosted
@@ -138,16 +141,10 @@ jobs:
138141 with :
139142 fetch-depth : 0
140143 submodules : ' recursive'
141- - name : Cache Self hosted
142- id : cache-self-hosted
143- uses : actions/cache@v4
144- env :
145- cache-name : ${{ github.repository }}-self-hosted
144+ - name : Download self hosted image
145+ uses : actions/download-artifact@v4
146146 with :
147- path : |
148- self-hosted-runtime.tar
149- self-hosted.tar
150- key : ${{ runner.os }}-${{ env.cache-name }}-${{ github.run_id }}
147+ name : self-hosted-image
151148 - name : Load built image
152149 run : |
153150 make load.self-hosted
0 commit comments