Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Transformerlab App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
TransformerLab
Transformerlab App
Commits
64677c70
Commit
64677c70
authored
1 year ago
by
Ali Asaria
Browse files
Options
Downloads
Patches
Plain Diff
bump version asks for confirmation first
parent
43bc22af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/bump_version.js
+24
-10
24 additions, 10 deletions
scripts/bump_version.js
with
24 additions
and
10 deletions
scripts/bump_version.js
+
24
−
10
View file @
64677c70
const
fs
=
require
(
'
fs
'
);
const
fs
=
require
(
'
fs
'
);
const
{
execSync
}
=
require
(
'
child_process
'
);
const
{
execSync
}
=
require
(
'
child_process
'
);
const
{
version
}
=
require
(
'
os
'
);
const
{
version
}
=
require
(
'
os
'
);
const
readline
=
require
(
'
node:readline
'
);
const
rl
=
readline
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
,
});
const
files
=
[
const
files
=
[
'
package.json
'
,
'
package.json
'
,
...
@@ -47,15 +53,23 @@ if (versionPart === 'patch') versionParts[2] = parseInt(versionParts[2]) + 1; //
...
@@ -47,15 +53,23 @@ if (versionPart === 'patch') versionParts[2] = parseInt(versionParts[2]) + 1; //
const
newVersion
=
versionParts
.
join
(
'
.
'
);
const
newVersion
=
versionParts
.
join
(
'
.
'
);
console
.
log
(
`Bumping version from
${
currentVersion
}
to
${
newVersion
}
`
);
console
.
log
(
`Bumping version from
${
currentVersion
}
to
${
newVersion
}
`
);
files
.
forEach
((
file
)
=>
{
rl
.
question
(
`Do you want to continue? (y/n) `
,
(
answer
)
=>
{
bumpVersion
(
file
,
newVersion
);
rl
.
close
();
});
if
(
answer
.
toLowerCase
()
!==
'
y
'
&&
answer
.
toLowerCase
()
!==
'
yes
'
)
{
console
.
log
(
'
Exiting process...
'
);
process
.
exit
(
1
);
}
else
{
files
.
forEach
((
file
)
=>
{
bumpVersion
(
file
,
newVersion
);
});
// Add the updated files to git, commit the changes, and tag the new commit
// Add the updated files to git, commit the changes, and tag the new commit
execSync
(
`git add
${
files
.
join
(
'
'
)}
`
);
execSync
(
`git add
${
files
.
join
(
'
'
)}
`
);
execSync
(
`git commit -m "Bump version to
${
newVersion
}
"`
);
execSync
(
`git commit -m "Bump version to
${
newVersion
}
"`
);
execSync
(
`git tag v
${
newVersion
}
`
);
execSync
(
`git tag v
${
newVersion
}
`
);
console
.
log
(
console
.
log
(
'
A new commit and tag have been created. Please push the changes to the remote repository to trigger a new build.
'
'
A new commit and tag have been created. Please push the changes to the remote repository to trigger a new build.
'
);
);
}
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment