diff --git a/.github/workflows/deploy-sites.yaml b/.github/workflows/deploy-sites.yaml
index 040b73c..433860a 100644
--- a/.github/workflows/deploy-sites.yaml
+++ b/.github/workflows/deploy-sites.yaml
@@ -34,9 +34,9 @@ jobs:
sites+=("${dir%/}")
fi
done
-
- # Create JSON array for matrix strategy
- sites_json=$(printf '%s\n' "${sites[@]}" | jq -R . | jq -s .)
+
+ # Create JSON array and output on single line
+ sites_json=$(printf '%s\n' "${sites[@]}" | jq -R . | jq -s -c .)
echo "sites=$sites_json" >> $GITHUB_OUTPUT
echo "Found sites: $sites_json"
@@ -54,48 +54,6 @@ jobs:
run: |
mkdir -p _site/${{ matrix.site }}
cp -r ${{ matrix.site }}/* _site/${{ matrix.site }}/
-
- # Create a root index if it doesn't exist
- if [ ! -f "_site/index.html" ]; then
- cat > _site/index.html << 'EOF'
-
-
-
- Sites Index
-
-
-
- 📁 Available Sites
-
-
-
-
- EOF
- fi
- name: Upload site artifact
uses: actions/upload-artifact@v4
@@ -103,9 +61,59 @@ jobs:
name: site-${{ matrix.site }}
path: _site
+ create-index:
+ runs-on: ubuntu-latest
+ needs: discover-sites
+ steps:
+ - name: Create root index
+ run: |
+ mkdir -p _site
+ cat > _site/index.html << 'EOF'
+
+
+
+ Sites Index
+
+
+
+ 📁 Available Sites
+
+
+
+
+ EOF
+ echo '${{ needs.discover-sites.outputs.sites }}' > _site/sites.json
+
+ - name: Upload index artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: site-index
+ path: _site
+
merge-and-deploy:
runs-on: ubuntu-latest
- needs: [discover-sites, build]
+ needs: [discover-sites, build, create-index]
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
@@ -114,14 +122,10 @@ jobs:
pattern: site-*
merge-multiple: true
- - name: Create sites index
- run: |
- echo '${{ needs.discover-sites.outputs.sites }}' > _site/sites.json
-
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: _site
- name: Deploy to GitHub Pages
- uses: actions/deploy-pages@v4
\ No newline at end of file
+ uses: actions/deploy-pages@v4