ci(scripts): add preview publish for nightly pipeline

pull/2824/head
mehmet-erim 6 years ago
parent 061027bda5
commit 7d2b195de9

@ -0,0 +1,3 @@
const fse = require("fs-extra");
console.log(fse.readJSONSync("package.json").version);

@ -82,7 +82,7 @@
"protractor": "~5.4.0", "protractor": "~5.4.0",
"rxjs": "~6.4.0", "rxjs": "~6.4.0",
"snq": "^1.0.3", "snq": "^1.0.3",
"symlink-manager": "^1.4.1", "symlink-manager": "^1.4.2",
"ts-node": "~7.0.0", "ts-node": "~7.0.0",
"tsickle": "^0.37.0", "tsickle": "^0.37.0",
"tslint": "~5.20.0", "tslint": "~5.20.0",

@ -4,6 +4,15 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@types/fs-extra": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.0.1.tgz",
"integrity": "sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/json5": { "@types/json5": {
"version": "0.0.29", "version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@ -463,9 +472,9 @@
} }
}, },
"commander": { "commander": {
"version": "4.0.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.0.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
"integrity": "sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==" "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="
}, },
"component-emitter": { "component-emitter": {
"version": "1.3.0", "version": "1.3.0",

@ -13,12 +13,13 @@
"author": "", "author": "",
"dependencies": { "dependencies": {
"babel-preset-node6": "^11.0.0", "babel-preset-node6": "^11.0.0",
"commander": "^4.0.1", "commander": "^4.1.1",
"execa": "^2.0.3", "execa": "^2.0.3",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"prompt-confirm": "^2.0.4" "prompt-confirm": "^2.0.4"
}, },
"devDependencies": { "devDependencies": {
"@types/fs-extra": "^8.0.1",
"@types/node": "^13.1.2", "@types/node": "^13.1.2",
"esm": "^3.2.25", "esm": "^3.2.25",
"ts-node": "^8.5.4", "ts-node": "^8.5.4",

@ -1,9 +1,22 @@
import execa from 'execa'; import execa from 'execa';
import fse from 'fs-extra'; import fse from 'fs-extra';
import program from 'commander';
program
.option(
"-v, --nextVersion <version>', 'next semantic version. Available versions: ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease', 'or type a custom version']",
)
.option('-p, --preview', 'publish with preview tag');
program.parse(process.argv);
const publish = async () => { const publish = async () => {
const versions = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease']; const versions = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease'];
let nextSemanticVersion = (process.argv[2] || '').toLowerCase();
if (!program.nextVersion) {
console.error('Please provide a version with --nextVersion attribute');
process.exit(1);
}
try { try {
await execa('yarn', ['install-new-dependencies'], { stdout: 'inherit' }); await execa('yarn', ['install-new-dependencies'], { stdout: 'inherit' });
@ -12,7 +25,7 @@ const publish = async () => {
await execa( await execa(
'yarn', 'yarn',
['lerna', 'version', nextSemanticVersion, '--yes', '--no-commit-hooks', '--skip-git'], ['lerna', 'version', program.nextVersion, '--yes', '--no-commit-hooks', '--skip-git'],
{ stdout: 'inherit', cwd: '../' }, { stdout: 'inherit', cwd: '../' },
); );
@ -26,7 +39,14 @@ const publish = async () => {
await execa( await execa(
'yarn', 'yarn',
['lerna', 'exec', '--', '"npm publish --registry https://registry.npmjs.org"'], [
'lerna',
'exec',
'--',
`"npm publish --registry https://registry.npmjs.org${
program.preview ? ' --tag preview' : ''
}"`,
],
{ {
stdout: 'inherit', stdout: 'inherit',
cwd: '../', cwd: '../',

@ -2,11 +2,23 @@
# yarn lockfile v1 # yarn lockfile v1
"@types/fs-extra@^8.0.1":
version "8.0.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.1.tgz#a2378d6e7e8afea1564e44aafa2e207dadf77686"
integrity sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==
dependencies:
"@types/node" "*"
"@types/json5@^0.0.29": "@types/json5@^0.0.29":
version "0.0.29" version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=
"@types/node@*":
version "13.7.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d"
integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA==
"@types/node@^13.1.2": "@types/node@^13.1.2":
version "13.1.2" version "13.1.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.2.tgz#fe94285bf5e0782e1a9e5a8c482b1c34465fa385" resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.2.tgz#fe94285bf5e0782e1a9e5a8c482b1c34465fa385"
@ -412,10 +424,10 @@ collection-visit@^1.0.0:
map-visit "^1.0.0" map-visit "^1.0.0"
object-visit "^1.0.0" object-visit "^1.0.0"
commander@^4.0.1: commander@^4.1.1:
version "4.0.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA== integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
component-emitter@^1.2.1: component-emitter@^1.2.1:
version "1.3.0" version "1.3.0"

@ -1,4 +1,5 @@
{ {
"version": "2.1.0",
"scripts": { "scripts": {
"lerna": "lerna", "lerna": "lerna",
"gulp:app": "node run-gulp-script.js ../templates/app/aspnet-core", "gulp:app": "node run-gulp-script.js ../templates/app/aspnet-core",
@ -7,11 +8,13 @@
"update:templates": "node abp-package-update-script.js ../templates" "update:templates": "node abp-package-update-script.js ../templates"
}, },
"devDependencies": { "devDependencies": {
"@types/fs-extra": "^8.0.1",
"glob": "^7.1.5", "glob": "^7.1.5",
"lerna": "^3.18.4", "lerna": "^3.18.4",
"npm-check-updates": "^3.1.25" "npm-check-updates": "^3.1.25"
}, },
"dependencies": { "dependencies": {
"execa": "^3.4.0" "execa": "^3.4.0",
"fs-extra": "^8.1.0"
} }
} }

@ -0,0 +1,29 @@
param(
[string]$Version
)
$NextVersion = $(node get-version.js) + '-preview' + (Get-Date).tostring(yyyyMMdd)
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
if(-Not $Version) {
$Version = $NextVersion;
}
$commands = (
"cd ng-packs\scripts",
"npm install",
"npm run publish-packages -- --nextVersion $Version --preview",
"cd ../../",
"yarn",
"yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish --dist-tag preview"
)
foreach ($command in $commands) {
Write-Host $command
Invoke-Expression $command
if($LASTEXITCODE -ne '0' -And $command -notlike '*cd *'){
Write-Host ("Process failed! " + $command)
Set-Location $rootFolder
exit $LASTEXITCODE
}
}

@ -2,17 +2,17 @@ param(
[string]$Version [string]$Version
) )
$NextVersion = $(node get-version.js)
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
if(-Not $Version) { if(-Not $Version) {
echo 'Please pass a semantic version like this: ./publish.ps1 -Version patch' $Version = $NextVersion;
exit
} }
$rootFolder = (Get-Item -Path "./" -Verbose).FullName
$commands = ( $commands = (
"cd ng-packs\scripts", "cd ng-packs\scripts",
"npm install", "npm install",
"npm run publish-packages -- $Version", "npm run publish-packages -- --nextVersion $Version",
"cd ../../", "cd ../../",
"yarn", "yarn",
"yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish", "yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish",

@ -832,6 +832,13 @@
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
"@types/fs-extra@^8.0.1":
version "8.0.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.1.tgz#a2378d6e7e8afea1564e44aafa2e207dadf77686"
integrity sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==
dependencies:
"@types/node" "*"
"@types/glob@^7.1.1": "@types/glob@^7.1.1":
version "7.1.1" version "7.1.1"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575"

Loading…
Cancel
Save