Browse Source

More releaser fixes (#10614)

Afshin Taylor Darian 3 years ago
parent
commit
d5538a5532
4 changed files with 24 additions and 7 deletions
  1. 7 0
      .github/workflows/check-release.yml
  2. 16 4
      buildutils/src/local-repository.ts
  3. 0 1
      package.json
  4. 1 2
      pyproject.toml

+ 7 - 0
.github/workflows/check-release.yml

@@ -61,3 +61,10 @@ jobs:
           RH_VERSION_SPEC: build
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Upload Assets
+        uses: actions/upload-artifact@v2
+        with:
+          name: dist-files
+          path: |
+            .jupyter_releaser_checkout/dist/*.*

+ 16 - 4
buildutils/src/local-repository.ts

@@ -1,5 +1,6 @@
 import * as fs from 'fs-extra';
 import * as child_process from 'child_process';
+import * as crypto from 'crypto';
 import * as path from 'path';
 import * as os from 'os';
 import * as ps from 'process';
@@ -192,10 +193,21 @@ function fixLinks(package_dir: string) {
   }
   yarn_reg = yarn_reg || 'https://registry.yarnpkg.com';
   const lock_file = path.join(package_dir, 'yarn.lock');
-  let content = fs.readFileSync(lock_file, { encoding: 'utf-8' });
+  console.log(`Fixing links in ${lock_file}`);
+  const content = fs.readFileSync(lock_file, { encoding: 'utf-8' });
+
+  let shasum = crypto.createHash('sha256');
+  let hash = shasum.update(content);
+  console.log('Prior hash', hash.digest('hex'));
+
   const regex = /http\:\/\/localhost\:\d+/g;
-  content = content.replace(regex, yarn_reg);
-  fs.writeFileSync(lock_file, content, 'utf8');
+  const new_content = content.replace(regex, yarn_reg);
+
+  shasum = crypto.createHash('sha256');
+  hash = shasum.update(new_content);
+  console.log('After hash', hash.digest('hex'));
+
+  fs.writeFileSync(lock_file, new_content, 'utf8');
 }
 
 const program = new Command();
@@ -221,7 +233,7 @@ program
   .command('fix-links')
   .option('--path <path>', 'Path to the directory with a yarn lock')
   .action((options: any) => {
-    fixLinks(options.out_dir || process.cwd());
+    fixLinks(options.path || process.cwd());
   });
 
 if (require.main === module) {

+ 0 - 1
package.json

@@ -24,7 +24,6 @@
   },
   "scripts": {
     "add:sibling": "node buildutils/lib/add-sibling.js",
-    "after:build:python": "node buildutils/lib/local-repository fix-links --path jupyterlab/staging",
     "after:publish:assets": "node buildutils/lib/publish --skip-publish",
     "analyze": "jlpm run analyze:dev",
     "analyze:dev": "cd dev_mode && jlpm run build --analyze",

+ 1 - 2
pyproject.toml

@@ -33,6 +33,5 @@ npm-install-options = "--legacy-peer-deps"
 [tool.jupyter-releaser.hooks]
 before-bump-version = ["git checkout .", "pip install bump2version"]
 before-build-npm = ["git commit -am 'Bump version'", "jlpm", "jlpm run build:utils", "jlpm run build:src"]
-before-build-python = ["node buildutils/lib/local-repository start", "jlpm run before:build:python"]
-after-build-python = ["jlpm run after:build:python", "node buildutils/lib/local-repository stop"]
+before-build-python = ["node buildutils/lib/local-repository start", "jlpm run before:build:python", "ls -ltr jupyterlab/staging", "node buildutils/lib/local-repository stop", "node buildutils/lib/local-repository fix-links --path jupyterlab/staging"]
 after-publish-assets = "jlpm run after:publish:assets"