Create tar.gz Folders for Latest Release #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zip Folders and Upload to GitHub Release | |
on: | |
workflow_dispatch: | |
jobs: | |
zip-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Find folders and zip them | |
id: zip | |
run: | | |
mkdir -p zip_outputs | |
for dir in */ ; do | |
if [[ "$dir" != ".github/" && -d "$dir" ]]; then | |
name="${dir%/}" | |
echo "Zipping $name..." | |
zip -r "zip_outputs/${name}.zip" "$name" -x "$name/README.md" | |
fi | |
done | |
- name: Get latest release tag | |
id: get_release | |
run: | | |
tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName') | |
echo "Latest tag is: $tag" | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload zip files to latest release | |
run: | | |
for file in zip_outputs/*.zip; do | |
gh release upload "${{ steps.get_release.outputs.tag }}" "$file" --clobber | |
gh release upload "latest" "$file" --clobber || true | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |