Skip to content

Commit 99b7d3e

Browse files
authored
build the vsix file (#56)
1 parent 1aa31c0 commit 99b7d3e

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.github/workflows/build-vsix.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build vsix file
2+
3+
on:
4+
workflow_dispatch
5+
jobs:
6+
build-vsix:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Get files
10+
uses: actions/checkout@v4
11+
- name: Install npm
12+
run: npm install
13+
- name: Install openapi-generator-cli
14+
run: npx openapi-generator-cli version
15+
- name: Test
16+
run: |
17+
sudo apt-get install dbus-x11 xvfb metacity at-spi2-core
18+
export DISPLAY=:88.0
19+
Xvfb -ac :88 -screen 0 1280x1024x16 > /dev/null 2>&1 &
20+
metacity --sm-disable --replace 2> metacity.err &
21+
npm test
22+
- name: Install vsce module
23+
run: npm install -g @vscode/vsce
24+
- name: Package the vsix file
25+
run: vsce package
26+
- name: Get version
27+
run: |
28+
export VERSION=`python3 -c 'import json; package=json.load(open("./package.json")); print(package["version"]);'`
29+
echo "VERSION=$VERSION" >> $GITHUB_ENV
30+
- name: Upload the vsix
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: mp-rest-client-generator-vscode-ext-${{ env.VERSION }}.vsix
34+
path: mp-rest-client-generator-vscode-ext-${{ env.VERSION }}.vsix

src/util/file.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ export function copy(src: string, dest: string) {
6262

6363
export const deleteDirectory = promisify(fsExtra.remove);
6464

65+
const isWindows = process.platform.indexOf('win') === 0;
66+
const JAVA_FILENAME = 'java' + (isWindows?'.exe': '');
6567
function javaExist(javaPath: string | undefined) : string | undefined {
6668
if (javaPath) {
67-
let java = path.join(javaPath, "bin/java");
69+
let java = path.join(javaPath, "bin");
70+
java = path.join(java, JAVA_FILENAME);
6871
if (fs.existsSync(java)) {
6972
return java;
7073
}

0 commit comments

Comments
 (0)