Zip and Publish Subfolders #16
Workflow file for this run
This file contains 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 Publish Subfolders | |
on: | |
release: | |
types: [published] | |
jobs: | |
zip-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Create zip files for each subfolder | |
run: | | |
for dir in $(find . -mindepth 1 -maxdepth 1 -type d); do | |
zip -r "${dir##*/}.zip" "$dir" | |
done | |
- name: Find zip files | |
id: find_zip_files | |
run: | | |
echo "files=$(find . -name '*.zip' | tr '\n' ',')" >> $GITHUB_ENV | |
- name: Upload each zip as a separate artifact | |
run: | | |
IFS=',' read -r -a files <<< "$files" | |
for file in "${files[@]}"; do | |
filename=$(basename "$file" .zip) | |
echo "Uploading $file as $filename" | |
gh actions upload-artifact --name "$filename" --path "$file" | |
done | |
env: | |
files: ${{ env.files }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |