debug: as JSON #82
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
# - 'sites/!(template/**)/**' | |
on: | |
push: | |
branches: [main, dynamic-matrix] | |
jobs: | |
prepare: | |
name: Prepare Matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{steps.matrix.outputs.matrix}} | |
continue: ${{steps.matrix.outputs.continue}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- run: echo "SITES=$(jq -c . < sites.json)" >> $GITHUB_ENV | |
- name: Packages Changed | |
id: changes | |
with: | |
list-files: shell | |
filters: | | |
deps: | |
- 'package.json' | |
sites: | |
- 'sites/**' | |
packages: | |
- 'packages/**' | |
uses: dorny/paths-filter@v3 | |
- name: Debug paths-filter | |
run: | | |
echo "sites files changed: ${{ steps.changes.outputs.sites_files }}" | |
- name: Transform Sites Changed | |
id: transformed-changes | |
run: | | |
sites=() | |
for filepath in ${{ steps.changes.outputs.sites_files }}; do | |
dir=$(echo "$filepath" | cut -d'/' -f2) | |
sites+=("$dir") | |
done | |
unique_sites=($(printf "%s\n" "${sites[@]}" | sort -u)) | |
echo "SITES_CHANGED=${unique_sites[@]}" >> $GITHUB_ENV | |
- name: Build Dynamic Matrix | |
if: ${{ steps.changes.outputs.sites }} | |
id: matrix | |
run: | | |
if [[ ${{ steps.changes.outputs.packages }} == true ]] || [[ ${{ steps.changes.outputs.deps }} == true ]]; then | |
node ./scripts/build_sites.mjs --all | |
echo "continue=true" >> $GITHUB_OUTPUT | |
elif [[ ${{ steps.changes.outputs.sites }} == true ]]; then | |
node ./scripts/build_sites.mjs | |
echo "continue=true" >> $GITHUB_OUTPUT | |
else | |
# successful step, but do not continue with a deployment | |
echo "continue=false" >> $GITHUB_OUTPUT | |
fi | |
publish: | |
needs: prepare | |
name: Publish to Cloudflare Pages | |
if: ${{ needs.prepare.outputs.continue == true }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
permissions: | |
contents: read | |
deployments: write | |
steps: | |
- name: Debug | |
run: | | |
echo "preparing to deploy:" | |
echo "Package: ${{ matrix.project }}" | |
echo "Project: ${{ matrix.package }}" | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# | |
# - name: Install Dependencies | |
# run: npm ci --omit=dev | |
# | |
# - name: Build | |
# run: npm run build -w ./sites/${{ matrix.package }} | |
# | |
# - name: Publish to Cloudflare Pages | |
# uses: cloudflare/pages-action@v1 | |
# with: | |
# apiToken: ${{ secrets.DEPLOY_TOKEN }} | |
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
# projectName: ${{ matrix.project }} | |
# directory: ./sites/${{ matrix.package }}/dist |