89
89
90
90
preview :
91
91
runs-on : ubuntu-latest
92
- needs :
93
- - build
94
- - test
92
+ needs : build
95
93
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
104
95
steps :
105
96
- name : Determine GitHub Pages directory name
106
97
id : branch_dir_name
@@ -114,21 +105,35 @@ jobs:
114
105
with :
115
106
name : build
116
107
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
118
125
uses : peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
119
126
with :
120
127
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}}"
123
130
full_commit_message : " Build for ${{ github.sha }} ${{ github.event.head_commit.message }}"
124
131
125
132
results :
126
- name : Results
133
+ name : Test Results
127
134
runs-on : ubuntu-latest
128
- needs :
129
- - test
130
- - preview
131
- if : ${{ always() }}
135
+ needs : test
136
+ if : ${{ !cancelled() }}
132
137
steps :
133
138
- run : |
134
139
case "${{ needs.test.result }}" in
@@ -146,19 +151,3 @@ jobs:
146
151
exit 1
147
152
;;
148
153
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