Create tar.gz Folders for Latest Release #16
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 and Upload Folders | |
on: | |
workflow_dispatch: | |
jobs: | |
zip-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create zip files for each folder (excluding .github and README.md) | |
run: | | |
mkdir -p zip_outputs | |
for dir in */ ; do | |
folder=$(basename "$dir") | |
if [ "$folder" != ".github" ]; then | |
zip -r "zip_outputs/${folder}.zip" "$dir" -x "${dir}README.md" | |
fi | |
done | |
- name: Find latest release tag | |
id: get_release | |
run: | | |
tag=$(gh release list --limit 1 --json tagName -q '.[0].tagName') | |
echo "Found latest release: $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 | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |