Skip to content

Commit 10e6b7c

Browse files
committed
ci: de-matrix GH Pages deploy
1 parent 4829910 commit 10e6b7c

File tree

1 file changed

+24
-35
lines changed

1 file changed

+24
-35
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,9 @@ jobs:
8989

9090
preview:
9191
runs-on: ubuntu-latest
92-
needs:
93-
- build
94-
- test
92+
needs: build
9593
if: ${{ needs.build.outputs.any-workspace == 'true' }}
96-
strategy:
97-
fail-fast: false
98-
matrix:
99-
package: ${{ fromJSON(needs.build.outputs.packages) }}
100-
exclude:
101-
- package: global
102-
- package: any-workspace
103-
name: Preview ${{ matrix.package }} on GH Pages
94+
name: Publish preview playgrounds to GH Pages
10495
steps:
10596
- name: Determine GitHub Pages directory name
10697
id: branch_dir_name
@@ -114,21 +105,35 @@ jobs:
114105
with:
115106
name: build
116107
path: packages
117-
- name: Deploy ${{ matrix.package }} testing playground to GitHub Pages
108+
- name: Prepare playgrounds for GH Pages
109+
working-directory: ./packages
110+
run: |
111+
mkdir -p ../pages/
112+
for pkg in *; do
113+
if [ -d "${pkg}/playground" ]; then
114+
# using symlinks is quick and artifact generation will dereference them
115+
# if the GH Pages action stops dereferencing these links, we'll need to copy the files instead
116+
ln -s "../packages/${pkg}/playground" "../pages/${pkg}"
117+
fi
118+
done
119+
120+
# scratch-gui doesn't follow the pattern above
121+
ln -s "../packages/scratch-gui/build" "../pages/scratch-gui"
122+
123+
ls -l ../pages/
124+
- name: Deploy playgrounds to GitHub Pages
118125
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
119126
with:
120127
github_token: ${{ secrets.GITHUB_TOKEN }}
121-
publish_dir: ./packages/${{ matrix.package }}/playground
122-
destination_dir: "${{steps.branch_dir_name.outputs.result}}/${{ matrix.package }}"
128+
publish_dir: ./pages
129+
destination_dir: "${{steps.branch_dir_name.outputs.result}}"
123130
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
124131

125132
results:
126-
name: Results
133+
name: Test Results
127134
runs-on: ubuntu-latest
128-
needs:
129-
- test
130-
- preview
131-
if: ${{ always() }}
135+
needs: test
136+
if: ${{ !cancelled() }}
132137
steps:
133138
- run: |
134139
case "${{ needs.test.result }}" in
@@ -146,19 +151,3 @@ jobs:
146151
exit 1
147152
;;
148153
esac
149-
- run: |
150-
case "${{ needs.preview.result }}" in
151-
success)
152-
echo "GitHub Pages previews published successfully."
153-
exit 0
154-
;;
155-
skipped)
156-
echo "Previews were unnecessary for these changes, so they were skipped."
157-
echo "If this is unexpected, check the path filters."
158-
exit 0
159-
;;
160-
*)
161-
echo "Publishing GitHub Pages previews failed."
162-
exit 1
163-
;;
164-
esac

0 commit comments

Comments
 (0)