* Update remove-stale-staging-resources workflow to completely replace undeploy workflow
* Delete the staging-undeploy-pr workflow file
* Delete all undeployment scripts and logic
* Remove all references to the automated-block-deploy label used for undeployment
* Simplify staging cross-workflow concurrency needs
* Make a dedicated, fast, workflow just for docs-internal only
Part of #1297
* make staging-build-pr only for github/docs
* prune later
* make it louder and clearer about disabling workflows
* does it merge?
* typo
* rename ref
* rename
* early access should be good to go
* far from perfect
* start with that
* gzip
* rearrange
* html_url
* correction of actions/checkout sha
* correction of actions/setup-node sha
* quote
* ooops
* actually deploy
* move @octokit/rest to dependencies
* await-sleep hack
* reinstall npm
* typo
* CONTEXT_NAME
* deployments:write permission
* pull-requests:read permission
* actions:read and statuses:write permissions
* private repo mention exception
* it's called github.run_id
* Apply suggestions from code review
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* make CONTEXT_NAME optional (if it works)
* comment out CONTEXT_NAME
* simplifying
* going to run on on.pull_request instead
* remove comment
* only the 2-phase staging deploy on github/docs
* better if statement on label check
* refactor of staging-deploy script
* switch to npm install to get the deDependencies back
* using --only=dev
* updating comments
* event_name
* not on pushes to main
* add staging-commit-status-success
* testing testing
* fix linting error
* Remove other docs-internal references from staging-deploy-pr.yml
* Cleaning up new staging-commit-status-success script and usage
* Remove unnecessary environment refs
* Remove unnecessary fallback
Since the only event trigger is pull_request now instead of also push
* Remove unnecessary env vars from workflow
* docs-internal or docs but not both
* Don't provide unnecessary environment refs
* remove now moot exception
* setting it to pull_request_target
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Do not use `build.status` of 'pending' as a looping condition for Heroku deployment
* Don't wait for `appSetup.status` either
* Fix incorrect Octokit method usage in local deploy script
* Bump the number of allowable errors from 5 to 10
* More logging!
* Add an environment variable for easily increasing the number of allowed Heroku failures per phase of polling
* Move concurrency control to top-level in prod deploy workflow
* Add 503 to the list of temporarily acceptable Heroku failure codes
* Add HEROKU_PRODUCTION_APP_NAME back into the prod deploy workflow
* Update the production deployment workflow to target the main Heroku app
Without exposing our internal Heroku app name!
* Refactor the staging deployment script a bit to match more closely
* Use the HEROKU_PRODUCTION_APP_NAME Secret in the workflow
* Add a note about the newly required environment variable for production deployment into the local deploy script
* Add critical errors if the HEROKU_PRODUCTION_APP_NAME is missing
* Extract HEROKU_PRODUCTION_APP_NAME from process.env
* Revert the critical parts of PR #21807 to no longer deploy to prod via Actions
* Don't require HEROKU_PRODUCITON_APP_NAME
* Update the production deployment workflow to target the main Heroku app
Without exposing our internal Heroku app name!
* Refactor the staging deployment script a bit to match more closely
* Use the HEROKU_PRODUCTION_APP_NAME Secret in the workflow
* Add a note about the newly required environment variable for production deployment into the local deploy script
* Add critical errors if the HEROKU_PRODUCTION_APP_NAME is missing
* Extract HEROKU_PRODUCTION_APP_NAME from process.env
* Use the 'script/deployment/create-staging-app-name' module when creating the content changes table comments
* Remove the shebang from the non-runnable script helper module
* Create a logic branch to deploy to production via a local script
* Ignore forceRebuild default value for production
* Add soft warnings for missing-but-not-critical env vars
* Only include the Preboot delay if the Fastly env vars are present
* Add some warning emojis ⚠️
* More emojis!
* Make FASTLY_* checks all independent
* Add more comments about additional env vars recommended for a local prod deployment
* add production deployment
* updating existing build
* remove state
* remove PR_URL and switch to main branch
* break out into build, prepare, and deploy
* update to download-artifact
* update staging to prod
* Actions production deployment redux (#21238)
* Simplify production deployment into a single Actions job
* Force esm to install
* Switch flag ordering to match staging deploy
* Use 'npm install' for the second installation to avoid deleting the prodDeps
* Apply Heroku upload fixes
* Include `.npmrc` file in builds to omit `optionalDeps`
* Remove download-artifact action
Co-authored-by: Grace Park <gracepark@github.com>
* Script updates to prod deployment (#21247)
* updating script to use latest sha
* changing back workflowRunLog
* remove line
* update error wording
* remove comment - using commit sha
* need release.id
* Update script/deployment/deploy-to-production.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* remove hydro
* Update script/deployment/deploy-to-production.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Update .github/workflows/prod-build-deploy-pr.yml
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Update script/deployment/deploy-to-production.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Update script/deployment/deploy-to-production.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Update script/deployment/deploy-to-production.js
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* updating spacing
* add 404/429 responses while polling Heroku API for prod
* removing nested ifs
* adding SOURCE_BLOB_URL
* update for early access
* add install dotenv
* need to add persist-credentials
* Testing GET request
* update request
* Rename workflow file to remove '-pr'
We are now triggering on pushes to 'main' rather than PR merges
* Remove the unnecessary workflow step to create a failure Status
Because the production deploy is done via a single workflow rather than a 2-part workflow chain, this is thankfully unnecessary
* Install all of the npm dependencies
We'll need them!
* Add the '-z' flag to 'tar' to gzip the tarball
* Pass the Heroku upload URL via env vars for security
Prevents potential injection attacks
* Log the deployment ID and log URL as deploy step outputs
* Take notice of Heroku polling resulting in failure statuses
* Add a note to consider waiting for Heroku Preboot
* Add a script and workflow step to purge Fastly
* update response to get sha
* Switch to Octokit functions instead of 'request' method
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Add a script to remove stale staging deployment environments from GitHub
* Add second job to cleanup GitHub deployment environments
* Specify GITHUB_TOKEN permissions matrix
* Stop marking staging deployments as transient
* Update staging undeployment mechanism to clean-up deployment environments on PR merge
* Define a stale PR as one that was merged or has been closed for more than 2 hours
* Rename workflow file
* Start parallel Docker image deploy workflows
Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@users.noreply.github.com>
* Add early access content build stage
Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
* Create Heroku App script and workflow steps
* Tag the image for Heroku
* Push the image and grab the image ID
* Set app name and image id outputs
* Add parallel deploy script for Docker
* Scope workflow run to 'docker-' and release image to Heroku
* Update .github/workflows/staging-build-pr-docker.yml
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Exclude Docker workflow
* Cleanup Docker deploys
* Use action sha
Co-authored-by: Mike Surowiec <mikesurowiec@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@users.noreply.github.com>
Co-authored-by: James M. Greene <JamesMGreene@github.com>
* Add a Staging build workflow
* Remove all commented out code from build workflow
It will be handled in https://github.com/github/docs-engineering/issues/726
* Use pinned version of upload-artifact action
* Tweaks to build
* Minor deployment script refactoring
* Update the Staging deployment workflow
* Missed refactoring tweak
* Add relevant comments
* Update Heroku app naming convention for Actions deploy to include 'gha-' prefix
* Update Heroku app ConfigVars and SourceBlob for optional prebuilt app
* Remove obsolete 'dist/' dir from PR build artifact
See https://github.com/github/docs-internal/pull/20405
* Ensure a new enough version of npm is used
* Switch to creating a tarball for upload
* Remove obsolete 'layouts' dir from file list
* Ditch the verbosity for 'tar'... too many files
* Add tarball support to deploy
* Add esm workaround to deploy script
See https://github.com/actions/github-script/issues/168
* Temporarily ignore staging deploy workflow from workflow linter
* Update deployment to use a Heroku Build Source instead of a GitHub Actions Artifact
* Update undeploy workflow to use ESM workaround
See https://github.com/actions/github-script/issues/168
* Add 'esm' package to optionalDependencies to better support workaround
See https://github.com/actions/github-script/issues/168
* Add Slack notifications for workflow failures
* Wrap AppSetup polling in try-catch
* Improve dyno monitoring
* Rename 'script/deploy' to have a .js extension #esm
* Update script references to include the extension
* Use non-deprecated Sources API for Heroku
* Use normal quotes
* Stub in a step to mark deployment inactive after timing out
* Apply suggestions from code review
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
* First run of script
* Get the app running --- ish
* Get NextJS working
* Remove `node:`
* Get more tests passing in unit directory
* Update FailBot test to use nock
* Update test.yml
* Update Dockerfile
* tests/content fixes
* Update page.js
* Update build-changelog.js
* updating tests/routing
* Update orphan-tests.js
* updating tests/rendering
* Update .eslintrc.js
* Update .eslintrc.js
* Install jest/globals
* "linting" tests
* staging update to server.mjs
* Change '.github/allowed-actions.js' to a ESM export
* Lint
* Fixes for the main package.json
* Move Jest to be last in the npm test command so we can pass args
* Just use 'npm run lint' in the npm test command
* update algolia label script
* update openapi script
* update require on openapi
* Update enterprise-algolia-label.js
* forgot JSON.parse
* Update lunr-search-index.js
* Always explicitly include process.cwd() for JSON file reads pathed from project root
* update graphql/update-files.js script
* Update other npm scripts using jest to pass ESM NODE_OPTIONS
* Update check-for-enterprise-issues-by-label.js for ESM
* Update create-enterprise-issue.js for ESM
* Import jest global for browser tests
* Convert 'script/deploy' to ESM
Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: James M. Greene <jamesmgreene@github.com>
* Add 'script/deploy' to enable manual deploys to Heroku
* Pass API tokens into 'deploy-to-staging' module usage
* Construct Octokit instance to pass in
* Get PR branch name and verify state
* Reorganize
* Rename option to 'octokit'
* Add missing option
* Actually use the convenience methods for convenience
* Simplify top-level script
* Top-level script revisions
* Add parse-pr-url module
* Add create-staging-app-name module
* Remove misplaced comment
* Pass in owner
* Use owner param
* More variables
* Pass owner along more
* Correct prNumber param reference
* Add WIP deploy-to-staging module
* Prevent 'scripts/' and '.github/actions-scripts/' files from being modified in open source repo
* Extract PR author earlier
* Add note about optionally supplying DOCUBOT_REPO_PAT env var
* Override Heroku env var during AppSetup creation instead of later to avoid triggering a second deploy
* Updates to deploy-to-staging module
* Lots of updates
* Add dyno start-up monitoring and warmup requests
* Ignore 'script/deploy' in the repository-references test
* Correct path to Octokit helper
* Temporarily add a 'gha-' prefix to environment names
* Log whole error if terminal. Good for Octokit errors!
* Correct Octokit preview configuration
* Add more logging around Heroku build and release
* Added more timings to log messages
* Monitor dyno states specifically from the dyno list view to avoid 404 oddities when Free dynos are dropped and non-Free dynos are added
* Don't wait for AppSetup status as it includes the Build time
* Updating logging since we don't see DeploymentStatus update messages in the UI =(
* Refactor to extract more properties from the PR object
* Add a workflow to deploy PRs to Staging
* Fix workflow description
* Add skeleton workflow and module for undeploying
* Remove commented out code
* Update undeployment module
* Add '--destroy' flag to 'script/deploy' options
* Add timeout and concurrency key for undeployment
* Add timeout and concurrency key for deployment
* Remove dangling unneeded function declaration
* Add ant-man preview for inactive deployment state setting
* Fix reference to pull request number
* Fix reference to pull request number
* Refactor to extract more properties from the PR object
* Fix reference to pull request number
* Remove workflow
* Add workflow to undeploy closed PRs from staging
* Add repository filters to jobs
* Update to using actions/github-script@4.0.2
* Pass more environment variables that affect deployments
* Add explicit .js extensions to local require in Actions workflow
* Check out the code and install deps first, of course
* Try local requires without the explicit .js extension
* Use our usual version of Octokit instead of the provided 'github' instance to avoid versioning discrepancies
* Explicitly pass in GITHUB_TOKEN to github-script
* Point to the workflow run page as a default log_url
* Exclude staging deployment workflows from the workflow linter until we can get support for the 'concurrency' key (https://github.com/cschleiden/actions-linter/issues/79)
* Remove 'gha-' prefix
* Add skeleton workflow and module for undeploying
* Remove commented out code
* Update undeployment module
* Add '--destroy' flag to 'script/deploy' options
* Add timeout and concurrency key for undeployment
* Remove dangling unneeded function declaration
* Add ant-man preview for inactive deployment state setting
* Fix reference to pull request number
* Refactor to extract more properties from the PR object
* Fix reference to pull request number
* Remove workflow
* Add a README comment about '--destroy' usage
* Fix grammar
* Add missing 'ant-man' preview to createDeploymentStatus calls
* Add missing preview to createDeploymentStatus calls
* Find the latest existing deployment instead of creating a new one
* Remove unused variable
* Deactivate ALL deployments
* Update copy
* Add missing colons
* Add 'script/deploy' to enable manual deploys to Heroku
* Pass API tokens into 'deploy-to-staging' module usage
* Construct Octokit instance to pass in
* Get PR branch name and verify state
* Reorganize
* Rename option to 'octokit'
* Add missing option
* Actually use the convenience methods for convenience
* Simplify top-level script
* Top-level script revisions
* Add parse-pr-url module
* Add create-staging-app-name module
* Remove misplaced comment
* Pass in owner
* Use owner param
* More variables
* Pass owner along more
* Correct prNumber param reference
* Add WIP deploy-to-staging module
* Prevent 'scripts/' and '.github/actions-scripts/' files from being modified in open source repo
* Extract PR author earlier
* Add note about optionally supplying DOCUBOT_REPO_PAT env var
* Override Heroku env var during AppSetup creation instead of later to avoid triggering a second deploy
* Updates to deploy-to-staging module
* Lots of updates
* Add dyno start-up monitoring and warmup requests
* Ignore 'script/deploy' in the repository-references test
* Correct path to Octokit helper
* Temporarily add a 'gha-' prefix to environment names
* Log whole error if terminal. Good for Octokit errors!
* Correct Octokit preview configuration
* Add more logging around Heroku build and release
* Added more timings to log messages
* Monitor dyno states specifically from the dyno list view to avoid 404 oddities when Free dynos are dropped and non-Free dynos are added
* Don't wait for AppSetup status as it includes the Build time
* Updating logging since we don't see DeploymentStatus update messages in the UI =(
* Remove commented out code
* Refactor to extract more properties from the PR object
* Fix reference to pull request number
* Increase Heroku polling intervals from 2.5 seconds to 5 seconds
* Remove unhelpful createDeploymentStatus API calls
* Workaround Heroku's secondary release upon app creation