Skip to content

Zip and Publish Subfolders #17

Zip and Publish Subfolders

Zip and Publish Subfolders #17

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)
echo "files=$files" >> $GITHUB_ENV
- name: Generate matrix configuration
id: generate-matrix
run: |
files=($files)
matrix="{\"include\":["
for file in "${files[@]}"; do
matrix+="{\"file\":\"$file\"},"
done
matrix="${matrix%,}]}"
echo "matrix=$matrix" >> $GITHUB_ENV
upload-artifacts:
needs: zip-and-publish
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(env.matrix) }}

Check failure on line 42 in .github/workflows/create-artifacts.yml

View workflow run for this annotation

GitHub Actions / Zip and Publish Subfolders

Invalid workflow file

The workflow is not valid. .github/workflows/create-artifacts.yml (Line: 42, Col: 15): Unrecognized named-value: 'env'. Located at position 10 within expression: fromJson(env.matrix) .github/workflows/create-artifacts.yml (Line: 42, Col: 15): Unexpected value '${{ fromJson(env.matrix) }}'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.file }}
path: ${{ matrix.file }}