From 7ae6376a8019f2ed095b1559f3b73ff899167f66 Mon Sep 17 00:00:00 2001 From: GamesTrap Date: Wed, 6 Nov 2024 23:55:55 +0100 Subject: [PATCH] Update save-cache and restore-cache actions 11/06/2024 | 24w45a3 --- .github/composite/restore-cache/action.yml | 6 +----- .github/composite/save-cache/action.yml | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/composite/restore-cache/action.yml b/.github/composite/restore-cache/action.yml index e9cc8b7f6..6033f2cf6 100644 --- a/.github/composite/restore-cache/action.yml +++ b/.github/composite/restore-cache/action.yml @@ -32,8 +32,8 @@ runs: shell: bash id: check-cache-linux if: runner.os == 'Linux' - continue-on-error: true run: | + set +e sudo apt install -y smbclient if smbclient //${{inputs.server-hostname}}/${{inputs.server-share}} -U ${{inputs.server-username}}%${{inputs.server-password}} -c 'ls "${{steps.build-dest-path.outputs.TARGET_PATH}}"' 2>/dev/null | grep -q "${{steps.build-dest-path.outputs.TARGET_PATH}}"; then echo "CACHE_HIT=true" >> "$GITHUB_OUTPUT" @@ -44,7 +44,6 @@ runs: id: check-cache-windows shell: powershell if: runner.os == 'Windows' - continue-on-error: true run: | New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\${{inputs.server-hostname}}\${{inputs.server-share}}" -Persist -Credential (New-Object System.Management.Automation.PSCredential ("${{inputs.server-username}}", (ConvertTo-SecureString "${{inputs.server-password}}" -AsPlainText -Force))) if (Test-Path "X:\${{steps.build-dest-path.outputs.TARGET_PATH}}") { @@ -56,20 +55,17 @@ runs: - name: Restore cache (Linux) shell: bash if: runner.os == 'Linux' && ${{steps.check-cache-linux.outputs.CACHE_HIT}} == "true" - continue-on-error: true run: | sudo apt install -y smbclient smbclient //${{inputs.server-hostname}}/${{inputs.server-share}} -U ${{inputs.server-username}}%${{inputs.server-password}} -c 'prompt; recurse; get "${{steps.build-dest-path.outputs.TARGET_PATH}}" "${{inputs.key}}.7z"' - name: Restore cache (Windows) shell: bash if: runner.os == 'Windows' && ${{steps.check-cache-windows.outputs.CACHE_HIT}} == "true" - continue-on-error: true run: | New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\${{inputs.server-hostname}}\${{inputs.server-share}}" -Persist -Credential (New-Object System.Management.Automation.PSCredential ("${{inputs.server-username}}", (ConvertTo-SecureString "${{inputs.server-password}}" -AsPlainText -Force))) Copy-Item -Path "X:\${{steps.build-dest-path.outputs.TARGET_PATH}}" -Destination ".\${{inputs.key}}.7z" Remove-PSDrive -Name "X" - name: Extract cache (7z) - continue-on-error: true shell: bash run: | 7z x -aos -bb0 -bse0 -bsp2 -pdefault -sccUTF-8 -o${{inputs.folder-path}} '${{inputs.key}}.7z' diff --git a/.github/composite/save-cache/action.yml b/.github/composite/save-cache/action.yml index 1ff8fb1cb..23ffafaab 100644 --- a/.github/composite/save-cache/action.yml +++ b/.github/composite/save-cache/action.yml @@ -33,8 +33,8 @@ runs: shell: bash id: check-cache-linux if: runner.os == 'Linux' - continue-on-error: true run: | + set +e sudo apt install -y smbclient if smbclient //${{inputs.server-hostname}}/${{inputs.server-share}} -U ${{inputs.server-username}}%${{inputs.server-password}} -c 'ls "${{steps.build-dest-path.outputs.TARGET_PATH}}"' 2>/dev/null | grep -q "${{steps.build-dest-path.outputs.TARGET_PATH}}"; then echo "CACHE_HIT=true" >> "$GITHUB_OUTPUT" @@ -45,7 +45,6 @@ runs: id: check-cache-windows shell: powershell if: runner.os == 'Windows' - continue-on-error: true run: | New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\${{inputs.server-hostname}}\${{inputs.server-share}}" -Persist -Credential (New-Object System.Management.Automation.PSCredential ("${{inputs.server-username}}", (ConvertTo-SecureString "${{inputs.server-password}}" -AsPlainText -Force))) if (Test-Path "X:\${{steps.build-dest-path.outputs.TARGET_PATH}}") { @@ -57,13 +56,11 @@ runs: - name: Archive cache (7z) shell: bash if: ${{steps.check-cache-linux.outputs.CACHE_HIT}} == "false" || ${{steps.check-cache-windows.outputs.CACHE_HIT}} == "false" - continue-on-error: true run: | 7z a -t7z -m0=LZMA2 -mmt=$(nproc) -mx9 -md=64m -mfb=64 -ms=16g -mqs=on -sccUTF-8 -bb0 -bse0 -bsp2 -w -mtc=on -mta=on '${{inputskey}}.7z' ${{inputs.folder-path}}/* - name: Upload cache (Windows) shell: powershell if: runner.os == 'Windows' && ${{steps.check-cache-windows.outputs.CACHE_HIT}} == "false" - continue-on-error: true run: | New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\${{inputs.server-hostname}}\${{inputs.server-share}}" -Persist -Credential (New-Object System.Management.Automation.PSCredential ("${{inputs.server-username}}", (ConvertTo-SecureString "${{inputs.server-password}}" -AsPlainText -Force))) Copy-Item -Path "${{inputs.key}}.7z" -Destination (New-Item -type directory -force "X:\${{steps.build-dest-path.outputs.TARGET_FOLDER_PATH}}") -force -ea 0 @@ -71,7 +68,6 @@ runs: - name: Upload cache (Linux) shell: bash if: runner.os == 'Linux' && ${{steps.check-cache-linux.outputs.CACHE_HIT}} == "false" - continue-on-error: true run: | sudo apt install -y smbclient smbclient //${{inputs.server-hostname}}/${{inputs.server-share}} -U ${{inputs.server-username}}%${{inputs.server-password}} -c 'prompt; recurse; mkdir "${{steps.build-dest-path.outputs.TARGET_FOLDER_PATH}}"; put "${{inputs.key}}.7z" "${{steps.build-dest-path.outputs.TARGET_PATH}}"'