Skip to content

Commit

Permalink
debug: testing control flow
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcguin committed Aug 22, 2024
1 parent 48c9324 commit ffe36eb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
43 changes: 21 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions scripts/build_sites.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);

0 comments on commit ffe36eb

Please sign in to comment.