@@ -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,38 +207,57 @@ 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 : |
205223 Start-Process "C:\Windows\System32\msiexec.exe" -Wait -ArgumentList @('/quiet', '/l*v tailscale.log', '/i', 'tailscale.msi')
206224 Add-Content $env:GITHUB_PATH "C:\Program Files\Tailscale\"
225+ Remove-Item tailscale.msi -Force;
226+ - name : Restore Tailscale - macOS
227+ if : ${{ inputs.use-cache == 'true' && runner.os == 'macOS' }}
228+ id : restore-cache-tailscale-macos
229+ uses : actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
230+ with :
231+ path : |
232+ /usr/local/bin/tailscale
233+ /usr/local/bin/tailscaled
234+ key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ runner.arch }}-${{ steps.checkout-tailscale-macos.outputs.commit }}
207235 - name : Checkout Tailscale repo - macOS
208236 id : checkout-tailscale-macos
209- if : ${{ runner.os == 'macOS' }}
237+ if : ${{ runner.os == 'macOS' && (inputs.use-cache != 'true' || steps.restore-cache-tailscale-macos.outputs.cache-hit != 'true') }}
210238 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
211239 with :
212240 repository : tailscale/tailscale
213241 path : ${{ github.workspace }}/tailscale
214242 ref : v${{ env.RESOLVED_VERSION }}
215- - name : Cache Tailscale - macOS
216- if : ${{ inputs.use-cache == 'true' && runner.os == 'macOS' }}
217- id : cache-tailscale-macos
218- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
219- with :
220- path : |
221- /usr/local/bin/tailscale
222- /usr/local/bin/tailscaled
223- 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 : Save Tailscale - macOS
253+ if : ${{ inputs.use-cache == 'true' && runner.os == 'macOS' }}
254+ id : save-cache-tailscale-macos
255+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
256+ with :
257+ path : |
258+ /usr/local/bin/tailscale
259+ /usr/local/bin/tailscaled
260+ key : ${{ runner.os }}-tailscale-${{ env.RESOLVED_VERSION }}-${{ runner.arch }}-${{ steps.checkout-tailscale-macos.outputs.commit }}
233261 - name : Install timeout - macOS
234262 if : ${{ runner.os == 'macOS' }}
235263 shell : bash
0 commit comments