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

Commit 151b641

Browse files
Merge branch 'master' into update-deps
# Conflicts: # packages/google-closure-compiler/package.json
2 parents 0691d4a + d83de18 commit 151b641

File tree

12 files changed

+54
-47
lines changed

12 files changed

+54
-47
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
architecture: x64
8888
- uses: actions/checkout@v2
8989
- name: Use Node.js ${{ env.NODE_VERSION }}
90-
uses: actions/setup-node@v1
90+
uses: actions/setup-node@v3
9191
with:
9292
node-version: ${{ env.NODE_VERSION }}
9393
- name: Setup upx
@@ -153,7 +153,7 @@ jobs:
153153
architecture: x64
154154
- uses: actions/checkout@v2
155155
- name: Use Node.js ${{ env.NODE_VERSION }}
156-
uses: actions/setup-node@v1
156+
uses: actions/setup-node@v3
157157
with:
158158
node-version: ${{ env.NODE_VERSION }}
159159
- name: Install upx
@@ -215,7 +215,7 @@ jobs:
215215
architecture: x64
216216
- uses: actions/checkout@v2
217217
- name: Use Node.js ${{ env.NODE_VERSION }}
218-
uses: actions/setup-node@v1
218+
uses: actions/setup-node@v3
219219
with:
220220
node-version: ${{ env.NODE_VERSION }}
221221
- name: Download compiler jar
@@ -285,9 +285,10 @@ jobs:
285285
steps:
286286
- uses: actions/checkout@v2
287287
- name: Use Node.js ${{ env.NODE_VERSION }}
288-
uses: actions/setup-node@v1
288+
uses: actions/setup-node@v3
289289
with:
290290
node-version: ${{ env.NODE_VERSION }}
291+
registry-url: https://registry.npmjs.org/
291292
- name: Download compiler jar
292293
uses: actions/download-artifact@v2
293294
with:
@@ -339,5 +340,7 @@ jobs:
339340
git config --global user.email "[email protected]"
340341
git config --global user.name "Github Bot"
341342
./build-scripts/create-nightly-version.js
343+
- name: Configure yarn
344+
run: yarn config set registry https://registry.npmjs.org/
342345
- name: Publish packages to npm
343346
run: yarn publish-packages

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ jobs:
4747
run: ./build-scripts/build_compiler.js
4848
- name: Create release commit and tag
4949
run: |
50+
git config --global user.email "[email protected]"
51+
git config --global user.name "Github Bot"
5052
git add compiler
5153
yarn version --new-version ${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0
5254
git push origin master
53-
git push origin v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}
55+
git push origin v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0
56+
- name: Create GitHub Release
57+
run: |
58+
curl \
59+
-X POST \
60+
-H 'Accept: application/vnd.github+json' \
61+
-H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
62+
https://api.github.com/repos/google/closure-compiler-npm/releases \
63+
-d '{"tag_name":"v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0","name":"${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0","body":"Closure-compiler ${{ github.event.inputs.COMPILER_VERSION_NUMBER }} release","draft":false,"prerelease":false,"generate_release_notes":true}'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn-error.log
1212
/packages/google-closure-compiler-js/jscomp.js
1313
/temp
1414
/publish-log.txt
15+
.npmrc

build-scripts/publish.js

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const path = require('path');
2929
const runCommand = require('./run-command');
3030

3131
const packagesDirPath = path.resolve(__dirname, '../packages');
32+
const npmrcPath = path.resolve(process.env.HOME, '.npmrc');
3233

3334
async function isPackageVersionPublished(packageName, version) {
3435
return fetch(`https://registry.npmjs.org/${encodeURI(packageName)}/${version}`)
@@ -38,8 +39,9 @@ async function isPackageVersionPublished(packageName, version) {
3839
async function isValidPackagePath(packageDir) {
3940
const packageJsonPath = `${packageDir}/package.json`;
4041
try {
42+
// check to see if the file already exists - if so do nothing
4143
await fs.stat(packageJsonPath);
42-
return true
44+
return true;
4345
} catch {
4446
return false;
4547
}
@@ -52,6 +54,20 @@ async function getPackageInfo(packageDir) {
5254
};
5355
}
5456

57+
async function setupNpm() {
58+
// For npm publication to work, the NPM token must be stored in the .npmrc file
59+
if (process.env.GITHUB_ACTIONS && process.env.NPM_TOKEN) {
60+
await fs.writeFile(
61+
npmrcPath,
62+
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\nregistry=https://registry.npmjs.org/`,
63+
'utf8');
64+
}
65+
}
66+
67+
async function cleanupNpmrc() {
68+
await fs.unlink(npmrcPath);
69+
}
70+
5571
async function publishPackagesIfNeeded(packageInfo) {
5672
const pkgJson = packageInfo.pkg;
5773
const isAlreadyPublished = await isPackageVersionPublished(pkgJson.name, pkgJson.version);
@@ -60,16 +76,15 @@ async function publishPackagesIfNeeded(packageInfo) {
6076
return;
6177
}
6278
console.log('Publishing', pkgJson.name, pkgJson.version);
63-
const publishArgs = [];
79+
const publishArgs = ['workspace', pkgJson.name, 'publish', `--new-version=${pkgJson.version}`];
6480
if (process.env.COMPILER_NIGHTLY ) {
65-
publishArgs.push('--npm-tag', 'nightly');
81+
publishArgs.push('--tag', 'nightly');
6682
}
67-
await runCommand('npm', ['publish'].concat(publishArgs), {
68-
cwd: packageInfo.path
69-
});
83+
await runCommand('yarn', publishArgs);
7084
}
7185

7286
(async () => {
87+
await setupNpm();
7388
const packagesDirEntries = await fs.readdir(packagesDirPath);
7489
// build a graph of the interdependencies of projects and only publish
7590
const graph = new graphlib.Graph({directed: true, compound: false});
@@ -112,4 +127,6 @@ async function publishPackagesIfNeeded(packageInfo) {
112127
throw new Error('Unable to publish packages: cyclical dependencies encountered.');
113128
}
114129
}
115-
})().catch((e) => { throw e });
130+
})().catch((e) => {
131+
throw e;
132+
}).finally(cleanupNpmrc);

compiler

Submodule compiler updated 274 files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "closure-compiler-npm",
3-
"version": "20220719.0.0",
3+
"version": "20220803.0.0",
44
"private": true,
55
"workspaces": {
66
"packages": [

packages/google-closure-compiler-java/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "google-closure-compiler-java",
3-
"version": "20220719.0.0",
3+
"version": "20220803.0.0",
44
"description": "Check, compile, optimize and compress Javascript with Closure-Compiler using Java",
55
"main": "index.js",
66
"repository": "https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler-java",

packages/google-closure-compiler-linux/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "google-closure-compiler-linux",
3-
"version": "20220719.0.0",
3+
"version": "20220803.0.0",
44
"description": "Check, compile, optimize and compress Javascript with Closure-Compiler using Java",
55
"main": "index.js",
66
"repository": "https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler-linux",

packages/google-closure-compiler-osx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "google-closure-compiler-osx",
3-
"version": "20220719.0.0",
3+
"version": "20220803.0.0",
44
"description": "Check, compile, optimize and compress Javascript with Closure-Compiler using Java",
55
"main": "index.js",
66
"repository": "https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler-osx",

packages/google-closure-compiler-windows/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "google-closure-compiler-windows",
3-
"version": "20220719.0.0",
3+
"version": "20220803.0.0",
44
"description": "Check, compile, optimize and compress Javascript with Closure-Compiler using Java",
55
"main": "index.js",
66
"repository": "https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler-windows",

0 commit comments

Comments
 (0)