Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare all necessary JS artifacts for build task #25842

Merged
merged 20 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8822f1f
Create script for setting the same version in all packages in monorepo
alexslavr Oct 18, 2023
e45e912
Include workspace root in script. Input version in workflow
alexslavr Oct 18, 2023
1c2647d
Copy artifacts for DXBuild
alexslavr Oct 19, 2023
b12d0ee
Clean up, add comments, copy bootstrap
alexslavr Oct 19, 2023
a5a3f7a
Fix naming, add "how to use", do not rewrite artifacts dir
alexslavr Oct 19, 2023
febfa55
Rename and fix workflow, add pull_request trigger for tests
alexslavr Oct 19, 2023
488446c
Add defaults in inputs / Update job name
Lykoi18 Oct 19, 2023
602f9df
Test "Update version" action
Lykoi18 Oct 19, 2023
925a0b0
Remove ref for checkout
Lykoi18 Oct 19, 2023
3989bfd
Setup git config
Lykoi18 Oct 20, 2023
e83036a
Update runner
Lykoi18 Oct 20, 2023
6137fa6
Revert testing changes
Lykoi18 Oct 20, 2023
977c5b9
Skip committing root package.json changes
Lykoi18 Oct 20, 2023
52ff15a
Update branch name for PR / Update PR title
Lykoi18 Oct 20, 2023
2bd3c34
Resolve conversations
Lykoi18 Oct 24, 2023
6f6b7e5
Merge remote-tracking branch 'origin/23_2' into prepare-build-artifacts
Lykoi18 Oct 24, 2023
d076609
Set actual version for devextreme-themebuilder and angular-playground
alexslavr Oct 24, 2023
e296f05
Remove condition for version replace in deps
alexslavr Oct 24, 2023
5ff9da2
Remove devextreme from dev deps in devextreme-angular, update lockfile
alexslavr Oct 24, 2023
e5b6508
Merge remote-tracking branch 'origin/23_2' into prepare-build-artifacts
Lykoi18 Oct 24, 2023
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
52 changes: 52 additions & 0 deletions .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update version in all workspaces

on:
workflow_dispatch:
inputs:
branch_name:
type: string
description: XX_X Branch name (23_2+)
required: true
version:
type: string
description: XX.X.X Set exact version
required: true

jobs:
update_version:
name: Update version and create PR
runs-on: ubuntu-latest
alexslavr marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Get sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_name }}

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.16.1'

- name: Setup git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "DX Robot"

- name: Install packages in devextreme repo
run: npm install --no-audit --no-fund

- name: Bump version
run: npm run all:update-version -- ${{ inputs.version }}

- name: Commit changes and make PR
env:
GITHUB_TOKEN: ${{ secrets.DX_ROBOT_PAT }}
branch_name: 'robot/update-version-${{ inputs.version }}'
run: |
git checkout -b $branch_name
git add . -N
git commit -a -m "Bump devextreme version"
git push --set-upstream origin $branch_name --force
gh pr create --base ${{ inputs.branch_name }} --title "Bump devextreme version (${{ inputs.version }})" --body "Bump devextreme version" --reviewer DevExpress/devextreme-devops

73 changes: 73 additions & 0 deletions build/build-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import sh from 'shelljs';
import path from 'node:path';

const MONOREPO_ROOT = path.join(__dirname, '..');
const INTERNAL_TOOLS_ARTIFACTS = path.join(MONOREPO_ROOT, 'artifacts', 'internal-tools');

const OUTPUT_DIR = path.join(MONOREPO_ROOT, 'artifacts');
const NPM_OUTPUT_DIR = path.join(OUTPUT_DIR, 'npm');

sh.mkdir('-p', NPM_OUTPUT_DIR);

const { 'devextreme-main': devextremeVersion, devextreme: devextremeNpmVersion } = JSON.parse(sh.exec('npm pkg get version -ws --json').stdout);
const MAJOR_VERSION = devextremeVersion.split('.').slice(0, 2).join('_');

// Prepare metadata
sh.cd(MONOREPO_ROOT);
sh.exec('npm run tools:discover-declarations');
sh.exec(`npm run tools -- make-aspnet-metadata --version ${MAJOR_VERSION}`);

// Inject descriptions
const DOCUMENTATION_TEMP_DIR = path.join(OUTPUT_DIR, 'doc_tmp');
sh.exec(`git clone -b ${MAJOR_VERSION} --depth 1 --config core.longpaths=true https://github.com/DevExpress/devextreme-documentation.git ${DOCUMENTATION_TEMP_DIR}`);

sh.pushd(DOCUMENTATION_TEMP_DIR);
sh.exec('npm i');
sh.exec(`npm run update-topics -- --artifacts ${INTERNAL_TOOLS_ARTIFACTS}`);
sh.popd();

sh.rm('-rf', DOCUMENTATION_TEMP_DIR);

sh.exec('npm run devextreme:inject-descriptions');

sh.exec('npm run build-dist -w devextreme-main');

// Copy artifacts for DXBuild (Installation)
sh.pushd(path.join(MONOREPO_ROOT, 'packages/devextreme/artifacts'));
sh.cp('-r', 'ts', OUTPUT_DIR);
sh.cp('-r', 'js', OUTPUT_DIR);
sh.cp('-r', 'css', OUTPUT_DIR);
sh.popd();

// TODO: maybe we should add bootstrap to vendors
const BOOTSTRAP_DIR = path.join(MONOREPO_ROOT, 'node_modules', 'bootstrap', 'dist');
sh.cp([path.join(BOOTSTRAP_DIR, 'js', 'bootstrap.js'), path.join(BOOTSTRAP_DIR, 'js', 'bootstrap.min.js')], path.join(OUTPUT_DIR, 'js'));
sh.cp([path.join(BOOTSTRAP_DIR, 'css', 'bootstrap.css'), path.join(BOOTSTRAP_DIR, 'js', 'bootstrap.min.css')], path.join(OUTPUT_DIR, 'css'));

// Update versions for non-semver builds (daily, alpha and beta)
if (devextremeVersion !== devextremeNpmVersion) {
sh.exec(`npm run all:update-version -- ${devextremeNpmVersion}`);
}

const DEVEXTREME_NPM_DIR = path.join(MONOREPO_ROOT, 'packages/devextreme/artifacts/npm');

sh.pushd(path.join(DEVEXTREME_NPM_DIR, 'devextreme'))
sh.exec('npm pack');
sh.cp('*.tgz', NPM_OUTPUT_DIR);
sh.popd();

sh.pushd(path.join(DEVEXTREME_NPM_DIR, 'devextreme-dist'))
sh.exec('npm pack');
sh.cp('*.tgz', NPM_OUTPUT_DIR);
sh.popd();

sh.pushd(path.join(MONOREPO_ROOT, 'packages', 'devextreme-themebuilder'))
sh.exec('npm run build && npm run pack');
sh.cp('dist/*.tgz', NPM_OUTPUT_DIR);
sh.popd();

sh.exec('npm run pack --ws --if-present');

sh.cp(path.join(MONOREPO_ROOT, 'packages', 'devextreme-angular', 'npm', 'dist', '*.tgz'), NPM_OUTPUT_DIR);
sh.cp(path.join(MONOREPO_ROOT, 'packages', 'devextreme-react', 'npm', '*.tgz'), NPM_OUTPUT_DIR);
sh.cp(path.join(MONOREPO_ROOT, 'packages', 'devextreme-vue', 'npm', '*.tgz'), NPM_OUTPUT_DIR);
54 changes: 0 additions & 54 deletions build/pack-all.ts

This file was deleted.

19 changes: 19 additions & 0 deletions build/update-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sh from 'shelljs';
import path from 'node:path';

const version = process.argv[2];

if (version == null) {
console.error(`Usage: 'npm run all:update-version -- $version' (XX.X.X)`);
process.exit(1);
}

const MONOREPO_ROOT = path.join(__dirname, '..');
const packagesPath = path.join(MONOREPO_ROOT, 'packages', '**', 'package.json');
const playgroundsPath = path.join(MONOREPO_ROOT, 'playgrounds', '**', 'package.json');

sh.exec(`npm version ${version} -ws --include-workspace-root --git-tag-version=false --workspaces-update=false`);

sh.sed('-i', /"devextreme(-angular|-react|-vue)?": ".*"/, `"devextreme$1": "~${version}"`, [packagesPath, playgroundsPath]);

sh.exec('npm i');
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"regenerate-all": "nx run-many -t regenerate",
"lint-staged": "lint-staged",
"prepare": "husky install",
"all:pack": "ts-node build/pack-all.ts"
"all:update-version": "ts-node build/update-version.ts",
"all:build": "ts-node build/build-all.ts"
},
"nx": {},
"private": true,
Expand Down
1 change: 0 additions & 1 deletion packages/devextreme-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"codelyzer": "6.0.2",
"core-js": "^2.6.12",
"del": "^2.2.2",
"devextreme": "~23.2.0",
"gulp": "^4.0.2",
"gulp-header": "^1.8.12",
"gulp-replace": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-themebuilder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "devextreme-themebuilder",
"version": "0.0.1",
"version": "23.2.0",
"description": "DevExtreme ThemeBuilder",
"keywords": [
"devextreme",
Expand Down
15 changes: 9 additions & 6 deletions playgrounds/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"name": "devextreme-angular-playground",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider ng serve --open -c dev",
"build": "echo empty"
},
"description": "DevExtreme Angular UI and Visualization Components",
"private": true,
"version": "23.2.0",
"author": "Developer Express Inc.",
"license": "MIT",
"dependencies": {
"@angular/animations": "~12.2.17",
"@angular/common": "~12.2.17",
Expand All @@ -30,5 +28,10 @@
"@angular/language-service": "12.2.17",
"@types/node": "8.10.66",
"ts-node": "7.0.1"
},
"scripts": {
"ng": "ng",
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider ng serve --open -c dev",
"build": "echo empty"
}
}
Loading