Skip to content

Commit 2fdbd5a

Browse files
committed
ci: de-matrix GH Pages deploy
1 parent 4829910 commit 2fdbd5a

File tree

1 file changed

+18
-35
lines changed

1 file changed

+18
-35
lines changed

.github/workflows/ci.yml

Lines changed: 18 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,29 @@ 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+
ln -s "../packages/${pkg}/playground" "../pages/${pkg}"
115+
fi
116+
done
117+
ls -l ../pages/
118+
- name: Deploy playgrounds to GitHub Pages
118119
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
119120
with:
120121
github_token: ${{ secrets.GITHUB_TOKEN }}
121-
publish_dir: ./packages/${{ matrix.package }}/playground
122-
destination_dir: "${{steps.branch_dir_name.outputs.result}}/${{ matrix.package }}"
122+
publish_dir: ./pages
123+
destination_dir: "${{steps.branch_dir_name.outputs.result}}"
123124
full_commit_message: "Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
124125

125126
results:
126-
name: Results
127+
name: Test Results
127128
runs-on: ubuntu-latest
128-
needs:
129-
- test
130-
- preview
131-
if: ${{ always() }}
129+
needs: test
130+
if: ${{ !cancelled() }}
132131
steps:
133132
- run: |
134133
case "${{ needs.test.result }}" in
@@ -146,19 +145,3 @@ jobs:
146145
exit 1
147146
;;
148147
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)