Skip to content

Zip and Publish Subfolders #22

Zip and Publish Subfolders

Zip and Publish Subfolders #22

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: List zip files
id: list_zip_files
run: |
files=$(ls *.zip | jq -R . | jq -s .)
echo "files=$files" >> $GITHUB_ENV
shell: bash
- name: Print output (in zip-and-publish)
run: echo "Output files ${{ env.files }}"
shell: bash
upload-artifacts:
needs: zip-and-publish
runs-on: ubuntu-latest
strategy:
matrix:
file: ${{ fromJson(needs.zip-and-publish.outputs.files) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.file }}
path: ${{ matrix.file }}