diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 299e8cf..430acc0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,33 +47,32 @@ jobs: if: ${{ steps.changes.outputs.sites }} id: matrix run: | - if [[ ${{ steps.changes.outputs.packages }} == true ] || [ ${{ steps.changes.outputs.deps == true }} ]]; then + if [[ ${{ steps.changes.outputs.packages }} == true ]] || [[ ${{ steps.changes.outputs.deps == true }} ]]; then node scripts/build_matrix.mjs --all - else + elif [[ ${{ steps.changes.outputs.sites }} == true ]]; then node scripts/build_sites.mjs + else + # successful step, but do not continue with a deployment + echo "continue=false" >> $GITHUB_OUTPUT fi - # 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) }} - # 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 }}" + 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 diff --git a/scripts/build_sites.mjs b/scripts/build_sites.mjs index 1bbea14..197122a 100644 --- a/scripts/build_sites.mjs +++ b/scripts/build_sites.mjs @@ -36,16 +36,16 @@ try { exit(1); } -// const matrix = { -// include: [ -// { -// project: "unicorn-demo", -// package: "unicorn-demo", -// }, -// ], -// }; -// -// appendFileSync( -// process.env.GITHUB_OUTPUT, -// `matrix=${JSON.stringify(matrix)}${os.EOL}` -// ); +const matrix = { + include: [ + { + project: "unicorn-demo", + package: "unicorn-demo", + }, + ], +}; + +appendFileSync( + process.env.GITHUB_OUTPUT, + `matrix=${JSON.stringify(matrix)}${os.EOL}` +);