Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit d04bb34

Browse files
Merge pull request #241 from google/remove-lerna
Remove the dependency on lerna
2 parents f90bee2 + 73c5623 commit d04bb34

File tree

18 files changed

+328
-3020
lines changed

18 files changed

+328
-3020
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ jobs:
274274
runs-on: ubuntu-latest
275275
if: ${{ github.event_name == 'schedule' || github.event_name == 'push' }}
276276
env:
277-
NODE_VERSION: '14.x'
277+
NODE_VERSION: '18.x'
278278
COMPILER_NIGHTLY: ${{ github.event_name == 'schedule' }}
279279
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_AUTH_TOKEN }}
280280
FORCE_COLOR: '1'
@@ -340,4 +340,4 @@ jobs:
340340
git config --global user.name "Github Bot"
341341
./build-scripts/create-nightly-version.js
342342
- name: Publish packages to npm
343-
run: ./build-scripts/lerna-publish.js publish-ci --npm-client ${{ github.workspace }}/build-scripts/npm-client.js --ignore-changes '**/*' --force-publish='*' --yes
343+
run: yarn publish-packages

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Compiler release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
COMPILER_VERSION_NUMBER:
7+
description: 'Compiler version to base release from'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
create-release:
13+
name: Create release
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
env:
18+
FORCE_COLOR: '1'
19+
NODE_VERSION: '18.x'
20+
steps:
21+
- name: Use Node.js ${{ env.NODE_VERSION }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
- name: Setup Java
26+
uses: actions/setup-java@v2
27+
with:
28+
distribution: adopt-hotspot
29+
java-version: 17
30+
java-package: jdk
31+
architecture: x64
32+
- name: Setup Bazel
33+
uses: jwlawson/actions-setup-bazel@v1
34+
with:
35+
bazel-version: '4.2.2'
36+
- uses: actions/checkout@v2
37+
with:
38+
submodules: recursive
39+
- name: Set compiler submodule to release branch
40+
working-directory: compiler
41+
run: |
42+
git fetch --tags https://github.com/google/closure-compiler.git
43+
git checkout v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}
44+
- name: Install packages
45+
run: yarn install --colors=always
46+
- name: Build jar
47+
run: ./build-scripts/build_compiler.js
48+
- name: Create release commit and tag
49+
run: |
50+
git add compiler
51+
yarn version --new-version ${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0
52+
git push origin master
53+
git push origin v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}

build-scripts/add-os-restrictions.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@
2020
*
2121
* Before publication, add OS restrictions to the graal packages.
2222
* They can't be present before publication as it errors out the installs.
23+
* Also set correct architectures. In order to execute `yarn install` in the main package, the current architecture
2324
*/
2425

2526
const fs = require('fs');
2627
const path = require('path');
2728

2829
// Maps of the os marketing name to the platform name used in package.json os restriction fields
2930
const osRestrictions = new Map([
30-
['osx', 'darwin'],
31-
['linux', 'linux'],
32-
['windows', 'win32']
31+
['osx', {os: ['darwin'], cpu: ['x32', 'x64', 'arm64']}],
32+
['linux', {os: ['linux'], cpu: ['x32', 'x64']}],
33+
['windows', {os: ['win32'], cpu: ['x32', 'x64']}]
3334
]);
3435

3536
// Read the package.json files, add the OS restriction, then write it back.
36-
osRestrictions.forEach((platformName, osName) => {
37-
const packagePath = path.resolve(__dirname, '..', 'packages', `google-closure-compiler-${osName}`, 'package.json');
37+
osRestrictions.forEach((osAndCpu, packageKey) => {
38+
const packagePath = path.resolve(__dirname, '..', 'packages', `google-closure-compiler-${packageKey}`, 'package.json');
3839
const packageContents = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
39-
packageContents.os = [platformName];
40+
packageContents.os = osAndCpu.os;
41+
packageContents.cpu = osAndCpu.cpu;
4042
fs.writeFileSync(packagePath, JSON.stringify(packageContents, null, 2) + '\n', 'utf8');
4143
});

build-scripts/create-nightly-version.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
*/
2222

2323
const runCommand = require('./run-command');
24-
const glob = require('glob');
25-
const path = require('path');
2624

2725
const today = new Date();
2826
const month = (today.getMonth() < 9 ? '0' : '') + (today.getMonth() + 1).toString();
@@ -33,29 +31,19 @@ const nightlyVersion = `${today.getFullYear()}${month}${day}.0.0-nightly`;
3331

3432
(async () => {
3533
try {
36-
// Lerna won't release packages on an already release tagged commit or
37-
// on a disconnected HEAD. Create a branch then commit the os changes for this nightly release.
34+
// Create a branch then commit the changes for this nightly release.
3835
await runCommand('git', ['checkout', '-b', `publish-${nightlyVersion}`]);
3936
await runCommand('git', ['add', 'compiler']);
40-
await runCommand('git', ['add', 'packages/google-closure-compiler-linux/package.json']);
41-
await runCommand('git', ['add', 'packages/google-closure-compiler-osx/package.json']);
42-
await runCommand('git', ['add', 'packages/google-closure-compiler-windows/package.json']);
43-
await runCommand('git', ['commit', '-m', `Create version for nightly release ${nightlyVersion}`]);
44-
// Get the list of packages in this repo
45-
const packages = glob.sync('packages/google-closure-compiler*')
46-
.map(packagePath => packagePath.replace('packages/', ''));
47-
48-
// Create a nightly version of all the packages
4937
await runCommand(
50-
'node',
51-
[
52-
'./build-scripts/lerna-publish.js',
53-
'version',
54-
nightlyVersion,
55-
'--push=false', // prevent the version commit from being pushed back to the repo
56-
`--force-publish=${packages.join(',')}`, // publish every package even though no changes are detected
57-
'--yes', // don't prompt for confirmation
58-
]);
38+
'yarn',
39+
[
40+
'version',
41+
'--new-version',
42+
nightlyVersion,
43+
'--message',
44+
`Create version for nightly release ${nightlyVersion}`
45+
]
46+
);
5947
} catch (e) {
6048
console.error(e);
6149
process.exitCode = 1;

build-scripts/lerna-publish.js

Lines changed: 0 additions & 209 deletions
This file was deleted.

0 commit comments

Comments
 (0)