mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-05 22:19:46 -06:00
Separate bump next version command (#922)
* set set-next-ci-version script command * use current package.json version when asking for next one * showing actual error response from buildkite * rename .aws-credentials.json to just aws-credentials.json file * rename aws_credentials_json on appveyor
This commit is contained in:
@@ -3,6 +3,9 @@ fs = require("fs-extra")
|
||||
glob = require("glob")
|
||||
Promise = require("bluebird")
|
||||
inquirer = require("inquirer")
|
||||
la = require("lazy-ass")
|
||||
check = require("check-more-types")
|
||||
path = require("path")
|
||||
|
||||
glob = Promise.promisify(glob)
|
||||
|
||||
@@ -74,17 +77,23 @@ getReleases = (releases) ->
|
||||
}
|
||||
}]
|
||||
|
||||
getNextVersion = ({ version }) ->
|
||||
getNextVersion = ({ version } = {}) ->
|
||||
if not version
|
||||
version = require(path.join(__dirname, "..", "..", "package.json")).version
|
||||
|
||||
message = "Bump next version to...? (currently: #{version})"
|
||||
defaultVersion = () ->
|
||||
a = version.split(".")
|
||||
v = a[a.length - 1]
|
||||
v = Number(v) + 1
|
||||
a.splice(a.length - 1, 1, v)
|
||||
a.join(".")
|
||||
|
||||
[{
|
||||
name: "nextVersion"
|
||||
type: "input"
|
||||
message: "Bump next version to...? (currently: #{version})"
|
||||
default: ->
|
||||
a = version.split(".")
|
||||
v = a[a.length - 1]
|
||||
v = Number(v) + 1
|
||||
a.splice(a.length - 1, 1, v)
|
||||
a.join(".")
|
||||
message: message
|
||||
default: defaultVersion
|
||||
}]
|
||||
|
||||
getVersions = (releases) ->
|
||||
@@ -177,6 +186,7 @@ whichBumpTask = ->
|
||||
.get("task")
|
||||
|
||||
nextVersion = (version) ->
|
||||
|
||||
prompt(getNextVersion(version))
|
||||
.get("nextVersion")
|
||||
|
||||
|
||||
@@ -90,7 +90,6 @@ remapMain = (projectsByProvider) ->
|
||||
# make flat list of objects
|
||||
# {repo, provider}
|
||||
PROJECTS = remapProjects(_PROVIDERS)
|
||||
MAIN_PROJECTS = remapMain(_PROVIDERS)
|
||||
|
||||
getCiConfig = ->
|
||||
key = path.join("scripts", "support", ".ci.json")
|
||||
@@ -150,18 +149,21 @@ getFilterByProvider = (providerName) ->
|
||||
|
||||
module.exports = {
|
||||
nextVersion: (version) ->
|
||||
console.table("All possible projects", MAIN_PROJECTS)
|
||||
MAIN_PROJECTS = remapMain(_PROVIDERS)
|
||||
console.log("Setting next version to build", version)
|
||||
console.table("In these projects", MAIN_PROJECTS)
|
||||
|
||||
la(check.unemptyString(version),
|
||||
"missing next version to set", version)
|
||||
|
||||
updateProject = (project, provider) ->
|
||||
console.log("setting %s environment variables in project %s", provider, project)
|
||||
setNextDevVersion = (project, provider) ->
|
||||
console.log("setting env var NEXT_DEV_VERSION to %s on %s in project %s",
|
||||
version, provider, project)
|
||||
car.updateProjectEnv(project, provider, {
|
||||
NEXT_DEV_VERSION: version,
|
||||
})
|
||||
|
||||
awaitEachProjectAndProvider(MAIN_PROJECTS, updateProject)
|
||||
awaitEachProjectAndProvider(MAIN_PROJECTS, setNextDevVersion)
|
||||
|
||||
# in each project, set a couple of environment variables
|
||||
version: (nameOrUrl, binaryVersionOrUrl, platform, providerName) ->
|
||||
|
||||
@@ -47,7 +47,8 @@ askMissingOptions = (properties = []) ->
|
||||
nextVersion: ask.nextVersion
|
||||
commit: ask.toCommit
|
||||
}
|
||||
return questionsRemain(_.pick(questions, properties))
|
||||
pickedQuestions = _.pick(questions, properties)
|
||||
questionsRemain(pickedQuestions)
|
||||
|
||||
## hack for @packages/server modifying cwd
|
||||
process.chdir(cwd)
|
||||
@@ -105,6 +106,15 @@ deploy = {
|
||||
.then (v) ->
|
||||
bump.version(v)
|
||||
|
||||
## sets environment variable on each CI provider
|
||||
## to NEXT version to build
|
||||
setNextVersion: ->
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
askMissingOptions(['nextVersion'])(options)
|
||||
.then ({nextVersion}) ->
|
||||
bump.nextVersion(nextVersion)
|
||||
|
||||
release: ->
|
||||
## read off the argv
|
||||
options = @parseOptions(process.argv)
|
||||
|
||||
@@ -22,7 +22,7 @@ formHashFromEnvironment = () ->
|
||||
throw new Error("Do not know how to form unique build hash on this CI")
|
||||
|
||||
getS3Credentials = () ->
|
||||
key = path.join('scripts', 'support', '.aws-credentials.json')
|
||||
key = path.join('scripts', 'support', 'aws-credentials.json')
|
||||
config = configFromEnvOrJsonFile(key)
|
||||
|
||||
if !config
|
||||
|
||||
Reference in New Issue
Block a user