1818 required : false
1919 default : " https://staging-editor-static.raspberrypi.org"
2020 type : string
21+ html_renderer_url :
22+ required : false
23+ default : " https://staging-editor-static.raspberrypi.org/"
24+ type : string
2125 react_app_api_endpoint :
2226 required : false
2327 default : " https://staging-editor-api.raspberrypi.org"
6266 required : false
6367 default : " https://staging-editor.raspberrypi.org,https://staging-editor-static.raspberrypi.org"
6468 type : string
65-
69+
6670 secrets :
6771 AWS_ACCESS_KEY_ID :
6872 required : false
8690 deploy_dir : ${{ steps.setup-environment.outputs.deploy_dir }}
8791 public_url : ${{ steps.setup-environment.outputs.public_url }}
8892 assets_url : ${{ steps.setup-environment.outputs.assets_url }}
93+ html_renderer_url : ${{ steps.setup-environment.outputs.html_renderer_url }}
8994 react_app_base_url : ${{ steps.setup-environment.outputs.react_app_base_url }}
9095 steps :
9196 - id : setup-environment
9499 deploy_dir=${{inputs.prefix}}/$safe_ref_name
95100 public_url=${{inputs.base_url}}/$deploy_dir
96101 assets_url=${{inputs.assets_url}}/$deploy_dir
102+ html_renderer_url=${{inputs.html_renderer_url}}/$deploy_dir/html-renderer
97103 echo "deploy_dir=$deploy_dir" >> $GITHUB_OUTPUT
98104 echo "public_url=$public_url" >> $GITHUB_OUTPUT
99105 echo "assets_url=$assets_url" >> $GITHUB_OUTPUT
106+ echo "html_renderer_url=$html_renderer_url" >> $GITHUB_OUTPUT
100107 if [ "${{inputs.react_app_base_url}}" = "unspecified" ] ; then
101108 echo "react_app_base_url=$deploy_dir" >> $GITHUB_OUTPUT
102109 else
@@ -139,6 +146,7 @@ jobs:
139146 env :
140147 PUBLIC_URL : ${{ needs.setup-environment.outputs.public_url }}
141148 ASSETS_URL : ${{ needs.setup-environment.outputs.assets_url }}
149+ HTML_RENDERER_URL : ${{ needs.setup-environment.outputs.html_renderer_url }}
142150 REACT_APP_API_ENDPOINT : ${{ inputs.react_app_api_endpoint }}
143151 REACT_APP_AUTHENTICATION_CLIENT_ID : ${{ inputs.react_app_authentication_client_id }}
144152 REACT_APP_AUTHENTICATION_URL : ${{ inputs.react_app_authentication_url }}
@@ -151,11 +159,18 @@ jobs:
151159 REACT_APP_SENTRY_ENV : ${{ inputs.react_app_sentry_env }}
152160 REACT_APP_ALLOWED_IFRAME_ORIGINS : ${{ inputs.react_app_allowed_iframe_origins }}
153161
162+ - name : Build HTML renderer bundle
163+ run : yarn build-html-renderer
164+ env :
165+ PUBLIC_URL : ${{ needs.setup-environment.outputs.html_renderer_url}}
166+ REACT_APP_ALLOWED_IFRAME_ORIGINS : ${{ inputs.react_app_allowed_iframe_origins }}
167+
154168 - name : Deploy site to S3 bucket
155169 if : env.AWS_SECRET_ACCESS_KEY != ''
156170 run : |
157171 aws s3 sync ./build/ s3://${{ secrets.AWS_S3_BUCKET }}/${{ needs.setup-environment.outputs.deploy_dir }} --endpoint ${{ secrets.AWS_ENDPOINT }}
158172 aws s3 sync ./build/chunks/ s3://${{ secrets.AWS_S3_BUCKET }}/chunks/ --endpoint ${{ secrets.AWS_ENDPOINT }} --exclude "*" --include "fetch-worker*"
173+ aws s3 sync ./build-html-renderer/ s3://${{ secrets.AWS_S3_BUCKET }}/${{ needs.setup-environment.outputs.deploy_dir }}/html-renderer/ --endpoint ${{ secrets.AWS_ENDPOINT }}
159174 env :
160175 AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
161176 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -168,7 +183,7 @@ jobs:
168183 curl -sS --fail-with-body -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
169184 -H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
170185 -H "Content-Type: application/json" \
171- --data '{"files":["${{ needs.setup-environment.outputs.public_url }}/web-component.html", "${{ needs.setup-environment.outputs.public_url }}/web-component.js", "${{ needs.setup-environment.outputs.public_url }}/scratch.html", "${{ needs.setup-environment.outputs.public_url }}/scratch.js"]} '
186+ --data '{"files":["${{ needs.setup-environment.outputs.public_url }}/web-component.html", "${{ needs.setup-environment.outputs.public_url }}/web-component.js", "${{ needs.setup-environment.outputs.public_url }}/scratch.html", "${{ needs.setup-environment.outputs.public_url }}/scratch.js", "${{ needs.setup-environment.outputs.html_renderer_url}}/index.html", "${{ needs.setup-environment.outputs.html_renderer_url}}/html_renderer.js]}" '
172187 )" || {
173188 echo "Cloudflare purge request failed:"
174189 echo "$response"
0 commit comments