ci: 💚 split into package and prepackage steps
This commit is contained in:
parent
3541d6a770
commit
405bc8ad7b
4 changed files with 45 additions and 40 deletions
10
.github/workflows/main.yaml
vendored
10
.github/workflows/main.yaml
vendored
|
|
@ -115,10 +115,10 @@ jobs:
|
|||
|
||||
# Run tests
|
||||
|
||||
- name: Package the extension
|
||||
- name: Prepare the extension
|
||||
run: |
|
||||
cd extension
|
||||
npm run package
|
||||
npm run prepackage
|
||||
|
||||
- name: Install Xvfb for Linux and run tests
|
||||
run: |
|
||||
|
|
@ -135,7 +135,11 @@ jobs:
|
|||
npm run test
|
||||
if: matrix.os != 'ubuntu-20.04'
|
||||
|
||||
# Upload .vsix artifact
|
||||
# Create and upload .vsix artifact
|
||||
- name: Package the extension
|
||||
run: |
|
||||
cd extension
|
||||
npm run package
|
||||
|
||||
- name: Upload .vsix as an artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@
|
|||
"lint": "eslint src --ext ts",
|
||||
"build-test": "tsc && node esbuild.test.mjs",
|
||||
"test": "npm run build-test && node ./out/test-runner/runTestOnVSCodeHost.js",
|
||||
"prepackage": "node scripts/prepackage.js",
|
||||
"package": "node scripts/package.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -1,42 +1,11 @@
|
|||
const { exec } = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
exec("npm install", (error) => {
|
||||
if (!fs.existsSync("build")) {
|
||||
fs.mkdirSync("build");
|
||||
}
|
||||
|
||||
exec("vsce package --out ./build patch", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm install completed");
|
||||
|
||||
exec("npm run typegen", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm run typegen completed");
|
||||
|
||||
process.chdir("react-app");
|
||||
|
||||
exec("npm install", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm install in react-app completed");
|
||||
|
||||
exec("npm run build", (error) => {
|
||||
if (error) throw error;
|
||||
if (!fs.existsSync(path.join("dist", "assets", "index.js"))) {
|
||||
throw new Error("react-app build did not produce index.js");
|
||||
}
|
||||
if (!fs.existsSync(path.join("dist", "assets", "index.css"))) {
|
||||
throw new Error("react-app build did not produce index.css");
|
||||
}
|
||||
console.log("npm run build in react-app completed");
|
||||
|
||||
process.chdir("..");
|
||||
|
||||
if (!fs.existsSync("build")) {
|
||||
fs.mkdirSync("build");
|
||||
}
|
||||
|
||||
exec("vsce package --out ./build patch", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("vsce package completed");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
console.log("vsce package completed");
|
||||
});
|
||||
|
|
|
|||
31
extension/scripts/prepackage.js
Normal file
31
extension/scripts/prepackage.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
const { exec } = require("child_process");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
exec("npm install", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm install completed");
|
||||
|
||||
exec("npm run typegen", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm run typegen completed");
|
||||
|
||||
process.chdir("react-app");
|
||||
|
||||
exec("npm install", (error) => {
|
||||
if (error) throw error;
|
||||
console.log("npm install in react-app completed");
|
||||
|
||||
exec("npm run build", (error) => {
|
||||
if (error) throw error;
|
||||
if (!fs.existsSync(path.join("dist", "assets", "index.js"))) {
|
||||
throw new Error("react-app build did not produce index.js");
|
||||
}
|
||||
if (!fs.existsSync(path.join("dist", "assets", "index.css"))) {
|
||||
throw new Error("react-app build did not produce index.css");
|
||||
}
|
||||
console.log("npm run build in react-app completed");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue