Skip to content

Commit 4129910

Browse files
authored
Update main.yml
1 parent 236fbd0 commit 4129910

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,10 @@ jobs:
329329
done
330330
331331
- name: '🧹 Remove artifacts'
332-
env:
333-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
334-
ACTIONS_STEP_DEBUG: true
335-
run: |
336-
artifacts=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[].name')
337-
for name in $artifacts; do
338-
echo "Deleting artifact: $name"
339-
gh api -X DELETE repos/${{ github.repository }}/actions/artifacts/$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq ".artifacts[] | select(.name==\"$name\") | .id")
340-
done
332+
uses: geekyeggo/delete-artifact@v5
333+
with:
334+
name: ${{ env.ARTIFACT_NAMES }}
335+
failOnError: false
341336

342337
development-release:
343338
needs: build
@@ -385,19 +380,34 @@ jobs:
385380
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
386381
ACTIONS_STEP_DEBUG: true
387382
run: |
383+
# for EXT in zip tar.gz run exe dmg; do
384+
# gh run download ${{ github.run_id }} -p artifact-*-$EXT
385+
# gh release upload development artifact-*-$EXT/* --clobber
386+
# rm -rf artifact-*-$EXT
387+
# done
388+
echo "ARTIFACT_NAMES=" >> $GITHUB_ENV
388389
for EXT in zip tar.gz run exe dmg; do
389-
gh run download ${{ github.run_id }} -p artifact-*-$EXT
390+
ARTIFACT_PATTERN=artifact-*-$EXT
391+
echo "Downloading artifacts matching: $ARTIFACT_PATTERN"
392+
gh run download ${{ github.run_id }} -p "$ARTIFACT_PATTERN"
393+
394+
echo "Uploading to release..."
390395
gh release upload development artifact-*-$EXT/* --clobber
396+
397+
for dir in artifact-*-$EXT; do
398+
echo "Found artifact dir: $dir"
399+
echo "${dir}" >> artifact_names.txt
400+
done
401+
391402
rm -rf artifact-*-$EXT
392403
done
393404

405+
echo "ARTIFACT_NAMES<<EOF" >> $GITHUB_ENV
406+
cat artifact_names.txt >> $GITHUB_ENV
407+
echo "EOF" >> $GITHUB_ENV
408+
394409
- name: '🧹 Remove artifacts'
395-
env:
396-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
397-
ACTIONS_STEP_DEBUG: true
398-
run: |
399-
artifacts=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[].name')
400-
for name in $artifacts; do
401-
echo "Deleting artifact: $name"
402-
gh api -X DELETE repos/${{ github.repository }}/actions/artifacts/$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq ".artifacts[] | select(.name==\"$name\") | .id")
403-
done
410+
uses: geekyeggo/delete-artifact@v5
411+
with:
412+
name: ${{ env.ARTIFACT_NAMES }}
413+
failOnError: false

0 commit comments

Comments
 (0)