@@ -21,7 +21,7 @@ concurrency:
2121jobs :
2222 build-and-deploy :
2323 if : ${{ github.repository == 'github/docs-internal'}}
24- runs-on : ${{ fromJSON('[" ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
24+ runs-on : ubuntu-latest
2525 timeout-minutes : 15
2626 steps :
2727 - name : Check out repo
@@ -129,12 +129,8 @@ jobs:
129129 -H 'Content-Type:' \
130130 --data-binary @app.tar.gz
131131
132- - name : Install one-off development-only dependencies
133- run : npm install --no-save --include=optional esm
134-
135132 - name : Deploy
136133 id : deploy
137- uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
138134 env :
139135 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
140136 HEROKU_API_TOKEN : ${{ secrets.HEROKU_API_TOKEN }}
@@ -144,56 +140,8 @@ jobs:
144140 SOURCE_BLOB_URL : ${{ steps.build-source.outputs.download_url }}
145141 DELAY_FOR_PREBOOT : ' true'
146142 ALLOWED_POLLING_FAILURES_PER_PHASE : ' 15'
147- with :
148- script : |
149- const {
150- GITHUB_TOKEN,
151- HEROKU_API_TOKEN,
152- HEROKU_PRODUCTION_APP_NAME,
153- SOURCE_BLOB_URL,
154- DELAY_FOR_PREBOOT
155- } = process.env
156-
157- // Exit if GitHub Actions PAT is not found
158- if (!GITHUB_TOKEN) {
159- throw new Error('You must supply a GITHUB_TOKEN environment variable!')
160- }
161-
162- // Exit if Heroku API token is not found
163- if (!HEROKU_API_TOKEN) {
164- throw new Error('You must supply a HEROKU_API_TOKEN environment variable!')
165- }
166-
167- // Exit if Heroku App name is not found
168- if (!HEROKU_PRODUCTION_APP_NAME) {
169- throw new Error('You must supply a HEROKU_PRODUCTION_APP_NAME environment variable!')
170- }
171-
172- // Workaround to allow us to load ESM files with `require(...)`
173- const esm = require('esm')
174- require = esm({})
175-
176- const { default: getOctokit } = require('./script/helpers/github')
177- const { default: deployToProduction } = require('./script/deployment/deploy-to-production')
178-
179- // This helper uses the `GITHUB_TOKEN` implicitly!
180- // We're using our usual version of Octokit vs. the provided `github`
181- // instance to avoid versioning discrepancies.
182- const octokit = getOctokit()
183-
184- try {
185- await deployToProduction({
186- octokit,
187- includeDelayForPreboot: DELAY_FOR_PREBOOT !== 'false',
188- // These parameters will ONLY be set by Actions
189- sourceBlobUrl: SOURCE_BLOB_URL,
190- runId: context.runId
191- })
192- } catch (error) {
193- console.error(`Failed to deploy to production: ${error.message}`)
194- console.error(error)
195- throw error
196- }
143+ RUN_ID : ${{ github.run_id }}
144+ run : .github/actions-scripts/prod-deploy.js
197145
198146 - name : Mark the deployment as inactive if timed out
199147 uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
@@ -227,26 +175,11 @@ jobs:
227175 console.log('⏲️ Deployment status: error - The deployment timed out...')
228176
229177 - name : Purge Fastly edge cache
230- uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
231178 env :
232179 FASTLY_TOKEN : ${{ secrets.FASTLY_TOKEN }}
233180 FASTLY_SERVICE_ID : ${{ secrets.FASTLY_SERVICE_ID }}
234181 FASTLY_SURROGATE_KEY : ' all-the-things'
235- with :
236- script : |
237- // Workaround to allow us to load ESM files with `require(...)`
238- const esm = require('esm')
239- require = esm({})
240-
241- const { default: purgeEdgeCache } = require('./script/deployment/purge-edge-cache')
242-
243- try {
244- await purgeEdgeCache()
245- } catch (error) {
246- console.error(`Failed to purge the edge cache: ${error.message}`)
247- console.error(error)
248- throw error
249- }
182+ run : .github/actions-scripts/purge-fastly-edge-cache.js
250183
251184 - name : Send Slack notification if workflow failed
252185 uses : someimportantcompany/github-actions-slack-message@f8d28715e7b8a4717047d23f48c39827cacad340
0 commit comments