Skip to content

Commit c466412

Browse files
authored
update
1 parent fa4980e commit c466412

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed
Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,42 @@
1-
name: Zip Folders and Upload to Release
1+
name: Zip Folders and Upload to GitHub Release
22

33
on:
44
workflow_dispatch:
55

66
jobs:
7-
zip-and-release:
7+
zip-and-upload:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- name: Checkout code
11+
- name: Checkout repository
1212
uses: actions/checkout@v4
1313

14-
- name: Zip each folder (excluding .github and README.md)
14+
- name: Find folders and zip them
15+
id: zip
1516
run: |
1617
mkdir -p zip_outputs
1718
for dir in */ ; do
1819
if [[ "$dir" != ".github/" && -d "$dir" ]]; then
1920
name="${dir%/}"
20-
echo "Zipping $name"
21+
echo "Zipping $name..."
2122
zip -r "zip_outputs/${name}.zip" "$name" -x "$name/README.md"
2223
fi
2324
done
2425
2526
- name: Get latest release tag
2627
id: get_release
2728
run: |
28-
tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName' || echo "")
29-
if [[ -z "$tag" ]]; then
30-
tag="auto-zip-$(date +%Y%m%d-%H%M%S)"
31-
echo "No existing release. Creating new release with tag $tag"
32-
gh release create "$tag" --title "Auto Zip Release $tag" --notes "Auto-generated zip files"
33-
else
34-
echo "Found existing release tag: $tag"
35-
fi
29+
tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
30+
echo "Latest tag is: $tag"
3631
echo "tag=$tag" >> $GITHUB_OUTPUT
3732
env:
3833
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3934

40-
- name: Ensure 'latest' release exists
41-
run: |
42-
if ! gh release view latest &>/dev/null; then
43-
echo "Creating 'latest' release"
44-
gh release create latest --title "Latest Auto Zip" --notes "Auto-generated zip files (latest)"
45-
fi
46-
env:
47-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- name: Upload zip files to releases
35+
- name: Upload zip files to latest release
5036
run: |
5137
for file in zip_outputs/*.zip; do
52-
echo "Uploading $file to tag: ${{ steps.get_release.outputs.tag }} and 'latest'"
5338
gh release upload "${{ steps.get_release.outputs.tag }}" "$file" --clobber
54-
gh release upload "latest" "$file" --clobber
39+
gh release upload "latest" "$file" --clobber || true
5540
done
5641
env:
5742
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)