1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/script/deployment/create-staging-app-name.js
Robert Sese cbfba14ac1 Docker image deploy to Heroku (#21248)
* 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>
2021-09-03 16:34:48 +00:00

20 lines
545 B
JavaScript

#!/usr/bin/env node
import GithubSlugger from 'github-slugger'
const slugify = GithubSlugger.slug
const APP_NAME_MAX_LENGTH = 30
export default function ({ prefix = 'gha', repo, pullNumber, branch }) {
return (
`${prefix}-${repo}-${pullNumber}--${slugify(branch)}`
// Shorten the string to the max allowed length
.slice(0, APP_NAME_MAX_LENGTH)
// Convert underscores to dashes
.replace(/_/g, '-')
// Remove trailing dashes
.replace(/-+$/, '')
// Make it all lowercase
.toLowerCase()
)
}