@@ -125,16 +125,16 @@ runs:
125125 fi
126126 echo "SHA256SUM=$SHA256SUM" >> $GITHUB_ENV
127127
128- - name : Cache Tailscale Binary - Linux
128+ - name : Restore Tailscale Binary - Linux
129129 if : ${{ inputs.use-cache == 'true' && runner.os == 'Linux' }}
130- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
131- id : cache-tailscale-linux
130+ uses : actions/cache/restore @5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
131+ id : restore- cache-tailscale-linux
132132 with :
133133 path : tailscale.tgz
134134 key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ env.TS_ARCH }}-${{ env.SHA256SUM }}
135135
136136 - name : Download Tailscale - Linux
137- if : ${{ runner.os == 'Linux' && (inputs.use-cache != 'true' || steps.cache-tailscale-linux.outputs.cache-hit != 'true') }}
137+ if : ${{ runner.os == 'Linux' && (inputs.use-cache != 'true' || steps.restore- cache-tailscale-linux.outputs.cache-hit != 'true') }}
138138 shell : bash
139139 run : |
140140 MINOR=$(echo "$RESOLVED_VERSION" | awk -F '.' {'print $2'})
@@ -148,12 +148,21 @@ runs:
148148 echo "Expected sha256: $SHA256SUM"
149149 echo "Actual sha256: $(sha256sum tailscale.tgz)"
150150 echo "$SHA256SUM tailscale.tgz" | sha256sum -c
151+
152+ - name : Save Tailscale Binary - Linux
153+ if : ${{ inputs.use-cache == 'true' && steps.restore-cache-tailscale-linux.outputs.cache-hit != 'true' && runner.os == 'Linux' }}
154+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
155+ id : save-cache-tailscale-linux
156+ with :
157+ path : tailscale.tgz
158+ key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ env.TS_ARCH }}-${{ env.SHA256SUM }}
151159
152160 - name : Install Tailscale - Linux
153161 if : ${{ runner.os == 'Linux' }}
154162 shell : bash
155163 run : |
156164 tar -C /tmp -xzf tailscale.tgz
165+ rm tailscale.tgz
157166 TSPATH=/tmp/tailscale_${RESOLVED_VERSION}_${TS_ARCH}
158167 sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
159168
@@ -175,16 +184,16 @@ runs:
175184 fi
176185 echo "SHA256SUM=$SHA256SUM" >> $GITHUB_ENV
177186
178- - name : Cache Tailscale Binary - Windows
187+ - name : Restore Tailscale Binary - Windows
179188 if : ${{ inputs.use-cache == 'true' && runner.os == 'Windows' }}
180- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
181- id : cache-tailscale-windows
189+ uses : actions/cache/restore @5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
190+ id : restore- cache-tailscale-windows
182191 with :
183192 path : tailscale.msi
184193 key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ env.TS_ARCH }}-${{ env.SHA256SUM }}
185194
186195 - name : Download Tailscale - Windows
187- if : ${{ runner.os == 'Windows' && (inputs.use-cache != 'true' || steps.cache-tailscale-windows.outputs.cache-hit != 'true') }}
196+ if : ${{ runner.os == 'Windows' && (inputs.use-cache != 'true' || steps.restore- cache-tailscale-windows.outputs.cache-hit != 'true') }}
188197 shell : bash
189198 run : |
190199 MINOR=$(echo "$RESOLVED_VERSION" | awk -F '.' {'print $2'})
@@ -198,12 +207,22 @@ runs:
198207 echo "Expected sha256: $SHA256SUM"
199208 echo "Actual sha256: $(sha256sum tailscale.msi)"
200209 echo "$SHA256SUM tailscale.msi" | sha256sum -c
210+
211+ - name : Save Tailscale Binary - Windows
212+ if : ${{ inputs.use-cache == 'true' && steps.restore-cache-tailscale-windows.outputs.cache-hit != 'true' && runner.os == 'Windows' }}
213+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
214+ id : save-cache-tailscale-windows
215+ with :
216+ path : tailscale.msi
217+ key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ env.TS_ARCH }}-${{ env.SHA256SUM }}
218+
201219 - name : Install Tailscale - Windows
202220 if : ${{ runner.os == 'Windows' }}
203221 shell : pwsh
204222 run : |
205- Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v tailscale.log', '/i', 'tailscale.msi')
223+ Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v ${{ runner.temp }}/ tailscale.log', '/i', 'tailscale.msi')
206224 Add-Content $env:GITHUB_PATH "C:\Program Files\Tailscale\"
225+ Remove-Item tailscale.msi -Force;
207226 - name : Checkout Tailscale repo - macOS
208227 id : checkout-tailscale-macos
209228 if : ${{ runner.os == 'macOS' }}
@@ -212,24 +231,38 @@ runs:
212231 repository : tailscale/tailscale
213232 path : ${{ github.workspace }}/tailscale
214233 ref : v${{ env.RESOLVED_VERSION }}
215- - name : Cache Tailscale - macOS
234+ - name : Restore Tailscale - macOS
216235 if : ${{ inputs.use-cache == 'true' && runner.os == 'macOS' }}
217- id : cache-tailscale-macos
218- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
236+ id : restore- cache-tailscale-macos
237+ uses : actions/cache/restore @5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
219238 with :
220239 path : |
221240 /usr/local/bin/tailscale
222241 /usr/local/bin/tailscaled
223242 key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ runner.arch }}-${{ steps.checkout-tailscale-macos.outputs.commit }}
224243 - name : Build Tailscale binaries - macOS
225- if : ${{ runner.os == 'macOS' && (inputs.use-cache != 'true' || steps.cache-tailscale-macos.outputs.cache-hit != 'true') }}
244+ if : ${{ runner.os == 'macOS' && (inputs.use-cache != 'true' || steps.restore- cache-tailscale-macos.outputs.cache-hit != 'true') }}
226245 shell : bash
227246 run : |
228247 cd tailscale
229248 export TS_USE_TOOLCHAIN=1
230249 ./build_dist.sh ./cmd/tailscale
231250 ./build_dist.sh ./cmd/tailscaled
232251 sudo mv tailscale tailscaled /usr/local/bin
252+ - name : Remove tailscale checkout - macOS
253+ if : ${{ runner.os == 'macOS' }}
254+ shell : bash
255+ run : |
256+ rm -Rf ${{ github.workspace }}/tailscale
257+ - name : Save Tailscale - macOS
258+ if : ${{ inputs.use-cache == 'true' && runner.os == 'macOS' }}
259+ id : save-cache-tailscale-macos
260+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
261+ with :
262+ path : |
263+ /usr/local/bin/tailscale
264+ /usr/local/bin/tailscaled
265+ key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ runner.arch }}-${{ steps.checkout-tailscale-macos.outputs.commit }}
233266 - name : Install timeout - macOS
234267 if : ${{ runner.os == 'macOS' }}
235268 shell : bash
0 commit comments