Skip to content

Commit 1b384b6

Browse files
committed
fix: apply workflow fixes to build-and-release.yml
- Add workspace cleanup step to fix permission issues - Add directory existence check in cache move step - Same fixes applied to snd.yml earlier
1 parent f018710 commit 1b384b6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/build-and-release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
release_type: ${{ steps.version.outputs.release_type }}
3636
docker_tag: ${{ steps.docker_tags.outputs.tag }}
3737
steps:
38+
- name: Clean workspace
39+
if: always()
40+
run: |
41+
sudo chown -R $USER:$USER ${{ github.workspace }} || true
42+
rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.* 2>/dev/null || true
43+
3844
- name: Checkout repository
3945
uses: actions/checkout@v4
4046
with:
@@ -145,6 +151,12 @@ jobs:
145151
platform: linux/arm64
146152
platform_tag: arm64
147153
steps:
154+
- name: Clean workspace
155+
if: always()
156+
run: |
157+
sudo chown -R $USER:$USER ${{ github.workspace }} || true
158+
rm -rf ${{ github.workspace }}/* ${{ github.workspace }}/.* 2>/dev/null || true
159+
148160
- name: Checkout repository
149161
uses: actions/checkout@v4
150162
with:
@@ -192,7 +204,9 @@ jobs:
192204
if: always()
193205
run: |
194206
rm -rf ${{ env.CACHE_PATH }}
195-
mv ${{ env.CACHE_PATH_NEW }} ${{ env.CACHE_PATH }}
207+
if [ -d "${{ env.CACHE_PATH_NEW }}" ]; then
208+
mv ${{ env.CACHE_PATH_NEW }} ${{ env.CACHE_PATH }}
209+
fi
196210
197211
merge:
198212
name: Merge Multi-Arch Image
@@ -585,4 +599,4 @@ jobs:
585599
body: newBody
586600
});
587601
588-
console.log(`✅ Updated PR #${context.issue.number}`);
602+
console.log(`✅ Updated PR #${context.issue.number}`);

0 commit comments

Comments
 (0)