Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@
"no_endpoint": true
},
"package_rollout": {
"only_consider_changesets_after": "b244fe702d8e96d016a52715e92c8131acfde3ba",
"disabled": $[STOP_AT_DEV]
"only_consider_changesets_after": "b244fe702d8e96d016a52715e92c8131acfde3ba"
},
"deployment_config_version": 7
}
1 change: 0 additions & 1 deletion .github/workflows/masterbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- master
- 'prerelease/**'
jobs:
build:
name: 'Build'
Expand Down
40 changes: 16 additions & 24 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
def parseSemanticVersion(String version) {
def semanticVersionRegex = /^(((([0-9]+)\.[0-9]+)\.[0-9]+)(?:\-.+)?)$/
def (_, prerelease, patch, minor, major) = (version =~ semanticVersionRegex)[0]
return [major, minor, patch, prerelease]
}

node('heavy && linux && docker') {
checkout scm
def tag = sh(script: "git tag --contains", returnStdout: true).trim()
def isBump = !!tag
def isOnReleaseBranch = env.BRANCH_NAME == 'master'
def isOnPrereleaseBranch = env.BRANCH_NAME.startsWith('prerelease/')
def isMaster = env.BRANCH_NAME == 'master'

if (!isOnReleaseBranch && !isOnPrereleaseBranch) {
if (!isMaster) {
return
}

Expand Down Expand Up @@ -39,14 +32,12 @@ node('heavy && linux && docker') {
sh 'git clean -f'
}

if (isOnReleaseBranch) {
withDockerContainer(image: 'node:16', args: '-u=root -e HOME=/tmp -e NPM_CONFIG_PREFIX=/tmp/.npm') {
stage('Npm publish') {
withCredentials([
string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN')]) {
sh "echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc"
sh 'npm run npm:publish:alpha || true'
}
withDockerContainer(image: 'node:16', args: '-u=root -e HOME=/tmp -e NPM_CONFIG_PREFIX=/tmp/.npm') {
stage('Npm publish') {
withCredentials([
string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN')]) {
sh "echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc"
sh 'npm run npm:publish:alpha || true'
}
}
}
Expand All @@ -57,22 +48,23 @@ node('heavy && linux && docker') {
headless = readJSON file: 'packages/headless/package.json'
atomic = readJSON file: 'packages/atomic/package.json'
atomicReact = readJSON file: 'packages/atomic-react/package.json'
semanticVersionRegex = /^([^\.]*)\.[^\.]*/

(headlessMinor, headlessMajor) = (headless.version =~ semanticVersionRegex)[0]
(atomicMinor, atomicMajor) = (atomic.version =~ semanticVersionRegex)[0]
(atomicReactMinor, atomicReactMajor) = (atomicReact.version =~ semanticVersionRegex)[0]

(headlessMajor, headlessMinor, headlessPatch) = parseSemanticVersion(headless.version)
(atomicMajor, atomicMinor, atomicPatch) = parseSemanticVersion(atomic.version)
(atomicReactMajor, atomicReactMinor, atomicReactPatch) = parseSemanticVersion(atomicReact)

sh "deployment-package package create --with-deploy \
--resolve HEADLESS_MAJOR_VERSION=${headlessMajor} \
--resolve HEADLESS_MINOR_VERSION=${headlessMinor} \
--resolve HEADLESS_PATCH_VERSION=${headlessPatch} \
--resolve HEADLESS_PATCH_VERSION=${headless.version} \
--resolve ATOMIC_MAJOR_VERSION=${atomicMajor} \
--resolve ATOMIC_MINOR_VERSION=${atomicMinor} \
--resolve ATOMIC_PATCH_VERSION=${atomicPatch} \
--resolve ATOMIC_PATCH_VERSION=${atomic.version} \
--resolve ATOMIC_REACT_MAJOR_VERSION=${atomicReactMajor} \
--resolve ATOMIC_REACT_MINOR_VERSION=${atomicReactMinor} \
--resolve ATOMIC_REACT_PATCH_VERSION=${atomicReactPatch} \
--resolve STOP_AT_DEV=${!isOnReleaseBranch} \
--resolve ATOMIC_REACT_PATCH_VERSION=${atomicReact.version} \
|| true"
}
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/deploy/bump-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ async function bumpVersionAndPush() {

async function main() {
try {
if ((await getHowManyCommitsBehind()) !== 0) {
const buildCommitHash = await getHeadCommitHash();
await checkoutLatestMaster();
const masterCommitHash = await getHeadCommitHash();

if (buildCommitHash !== masterCommitHash) {
console.log(
'Build commit does not match latest commit. Skipping version bump.'
'Build commit does not match latest master commit. Skipping version bump.'
);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions scripts/deploy/invalidate-cloudfront.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import {CloudFront} from 'aws-sdk';
import {resolve} from 'path';
import {getPackageFromPath, workspacesRoot} from '../packages.mjs';
import {getPackageFromPath} from '../packages.mjs';

const cloudfront = new CloudFront();

async function getMajorVersion(dir) {
const {version} = getPackageFromPath(
resolve(workspacesRoot, 'packages', dir, 'package.json')
resolve('..', '..', 'packages', dir, 'package.json')
);
return version.split('.')[0];
}

async function main() {
const pathsToInvalidate = [
'/atomic/latest/*',
`/atomic/v${await getMajorVersion('atomic')}/*`,
'/headless/latest/*',
`/headless/v${await getMajorVersion('headless')}/*`,
];

Expand Down
13 changes: 4 additions & 9 deletions scripts/deploy/update-npm-tag.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import {resolve} from 'path';
import {execute} from '../exec.mjs';
import {
packageDirsNpmTag,
getPackageFromPath,
workspacesRoot,
} from '../packages.mjs';
import {packageDirsNpmTag, getPackageFromPath} from '../packages.mjs';
import {resolve} from 'path';
import {promisify} from 'util';

async function main() {
const requests = packageDirsNpmTag
.map((dir) =>
getPackageFromPath(
resolve(workspacesRoot, 'packages', dir, 'package.json')
)
getPackageFromPath(resolve('..', '..', 'packages', dir, 'package.json'))
)
.map(({name, version}) => updateNpmTag(name, version));

Expand Down
25 changes: 0 additions & 25 deletions scripts/git.js

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/notify-docs/published-ui-kit.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {Octokit} from '@octokit/rest';
import {resolve} from 'path';
import {getPackageFromPath, workspacesRoot} from '../packages.mjs';
import {getPackageFromPath} from '../packages.mjs';

const headlessPackageJson = getPackageFromPath(
resolve(workspacesRoot, 'packages', 'headless', 'package.json')
resolve('..', '..', 'packages', 'headless', 'package.json')
);
const atomicPackageJson = getPackageFromPath(
resolve(workspacesRoot, 'packages', 'atomic', 'package.json')
resolve('..', '..', 'packages', 'atomic', 'package.json')
);
const quanticPackageJson = getPackageFromPath(
resolve(workspacesRoot, 'packages', 'quantic', 'package.json')
resolve('..', '..', 'packages', 'quantic', 'package.json')
);

const token = process.env.GITHUB_TOKEN || '';
Expand Down