debug: test as string #67
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
on: | |
push: | |
branches: [main, dynamic-matrix] | |
jobs: | |
prepare: | |
name: Prepare Matrix Output | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{steps.matrix.outputs.matrix}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setting SITES | |
run: echo "SITES=$(jq -c . < sites.json)" >> $GITHUB_ENV | |
# doesn't work with "act" | |
- name: Packages Changed | |
id: changes | |
with: | |
list-files: shell | |
filters: | | |
deps: | |
- 'package.json' | |
sites: | |
- 'sites/**' | |
packages: | |
- 'packages/**' | |
uses: dorny/paths-filter@v3 | |
- name: Transform Sites Changed | |
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 | |
echo "FILES_CHANGED=${{ steps.changes.outputs }}" >> $GITHUB_ENV | |
- name: Inspect Packages Changed | |
run: | | |
echo "Outputs: ${{ toJSON(steps.changes.outputs) }}" | |
echo "Changes: ${{ steps.changes.outputs.changes }}" | |
echo "Packages Changed: ${{ steps.changes.outputs.sites_files }}" | |
- name: Build Dynamic Matrix | |
id: matrix | |
run: node scripts/build_sites.mjs | |
# 1. get the packages changed | |
# 2. If the core package was changed, deploy all sites | |
# 3. If only a certain site OR sites was changed, only deploy those sites. | |
# 4. Build the matrix JSON structure as seen below dynamically based on the above conditions | |
# publish: | |
# needs: prepare | |
# name: Publish to Cloudflare Pages | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: ${{ fromJson(needs.prepare.outputs.matrix) }} | |
# | |
# permissions: | |
# contents: read | |
# deployments: write | |
# | |
# steps: | |
# - name: Debug | |
# run: | | |
# 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 |