chore(build): separate version from build (#3447)
and cleared that thing and rotated it too
This commit is contained in:
parent
ef9363e8b9
commit
4938014a21
@ -284,7 +284,7 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
node ./increaseEventEmitterLimit.mjs
|
node ./increaseEventEmitterLimit.mjs
|
||||||
- run:
|
- run:
|
||||||
name: build half of the packages
|
name: build half of the packages (to avoid out of memory in circleci)
|
||||||
command: |
|
command: |
|
||||||
yarn run build:package-all
|
yarn run build:package-all
|
||||||
- run:
|
- run:
|
||||||
@ -292,9 +292,17 @@ jobs:
|
|||||||
command: |
|
command: |
|
||||||
yarn run build:package-all-1
|
yarn run build:package-all-1
|
||||||
- run:
|
- run:
|
||||||
name: version and publish all packages
|
name: publish package versions
|
||||||
command: |
|
command: |
|
||||||
node ./publish.mjs
|
node ./publish-version.mjs
|
||||||
|
- run:
|
||||||
|
name: Again set the NPM registry (was deleted in the version script)
|
||||||
|
command:
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
|
||||||
|
- run:
|
||||||
|
name: publish package dist
|
||||||
|
command: |
|
||||||
|
node ./publish-package.mjs
|
||||||
|
|
||||||
DOCKER_RELEASE_PUBLISH:
|
DOCKER_RELEASE_PUBLISH:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|||||||
1
.npmrc
1
.npmrc
@ -1 +0,0 @@
|
|||||||
//registry.npmjs.org/:_authToken=16ec041c-ce66-48f0-a463-7429164d7801
|
|
||||||
40
publish-package.mjs
Normal file
40
publish-package.mjs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { execa } from 'execa';
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
const { stdout: branchName } = await execa('git', [
|
||||||
|
'rev-parse',
|
||||||
|
'--abbrev-ref',
|
||||||
|
'HEAD',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// using the environment variable NPM_TOKEN, create a .npmrc file
|
||||||
|
// and set the token to the value of the environment variable
|
||||||
|
// Publishing each package, if on master/main branch publish beta versions
|
||||||
|
// otherwise publish latest
|
||||||
|
if (branchName === 'release') {
|
||||||
|
await execa('npx', [
|
||||||
|
'lerna',
|
||||||
|
'publish',
|
||||||
|
'from-package',
|
||||||
|
'--no-verify-access',
|
||||||
|
'--yes',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
await execa('npx', [
|
||||||
|
'lerna',
|
||||||
|
'publish',
|
||||||
|
'from-package',
|
||||||
|
'--no-verify-access',
|
||||||
|
'--yes',
|
||||||
|
'--dist-tag',
|
||||||
|
'beta',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Finished');
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch(err => {
|
||||||
|
console.error('Error encountered during package publish:', err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
@ -68,10 +68,16 @@ async function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove the .npmrc to not accidentally publish to npm
|
||||||
|
await fs.unlink('.npmrc');
|
||||||
|
|
||||||
|
// rm -f ./.npmrc again
|
||||||
|
await execa('rm', ['-f', '.npmrc']);
|
||||||
|
|
||||||
// Todo: Do we really need to run the build command here?
|
// Todo: Do we really need to run the build command here?
|
||||||
// Maybe we need to hook the netlify deploy preview
|
// Maybe we need to hook the netlify deploy preview
|
||||||
// await execa('yarn', ['run', 'build']);
|
// await execa('yarn', ['run', 'build']);
|
||||||
// console.log('Build command completed');
|
|
||||||
console.log('Committing and pushing changes...');
|
console.log('Committing and pushing changes...');
|
||||||
await execa('git', ['add', '-A']);
|
await execa('git', ['add', '-A']);
|
||||||
await execa('git', [
|
await execa('git', [
|
||||||
@ -94,31 +100,8 @@ async function run() {
|
|||||||
'--message',
|
'--message',
|
||||||
'chore(version): Update package versions [skip ci]',
|
'chore(version): Update package versions [skip ci]',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.log('Version set using lerna');
|
console.log('Version set using lerna');
|
||||||
|
|
||||||
// Publishing each package, if on master/main branch publish beta versions
|
|
||||||
// otherwise publish latest
|
|
||||||
if (branchName === 'release') {
|
|
||||||
await execa('npx', [
|
|
||||||
'lerna',
|
|
||||||
'publish',
|
|
||||||
'from-package',
|
|
||||||
'--no-verify-access',
|
|
||||||
'--yes',
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
await execa('npx', [
|
|
||||||
'lerna',
|
|
||||||
'publish',
|
|
||||||
'from-package',
|
|
||||||
'--no-verify-access',
|
|
||||||
'--yes',
|
|
||||||
'--dist-tag',
|
|
||||||
'beta',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Finished');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch(err => {
|
run().catch(err => {
|
||||||
@ -65,6 +65,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('Next version:', nextVersion);
|
console.log('Next version:', nextVersion);
|
||||||
|
console.log('Current commit hash:', currentCommitHash);
|
||||||
|
|
||||||
const versionInfo = { version: nextVersion, commit: currentCommitHash };
|
const versionInfo = { version: nextVersion, commit: currentCommitHash };
|
||||||
await fs.writeFile('./version.json', JSON.stringify(versionInfo, null, 2));
|
await fs.writeFile('./version.json', JSON.stringify(versionInfo, null, 2));
|
||||||
@ -75,6 +76,6 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run().catch(err => {
|
run().catch(err => {
|
||||||
console.error('Error encountered during version bump:', err);
|
console.error('Error encountered during new version & commit write:', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user