From 9b433a0dbaebdcd412bf2db9d795c179a6161c5c Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 13 Nov 2024 17:19:09 -0800 Subject: [PATCH] add github actions for packaging --- .github/workflows/{go.yml => vsix.yml} | 22 +++++++++++----------- client/build.mjs | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) rename .github/workflows/{go.yml => vsix.yml} (57%) diff --git a/.github/workflows/go.yml b/.github/workflows/vsix.yml similarity index 57% rename from .github/workflows/go.yml rename to .github/workflows/vsix.yml index 049b7ef..e1f45b5 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/vsix.yml @@ -1,7 +1,4 @@ -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - -name: Go +name: Package VSIX on: push: @@ -22,25 +19,28 @@ jobs: - name: Build run: | - cd server - GOOS=linux GOARCH=amd64 go build -o linux/vls - GOOS=windows GOARCH=amd64 go build -o windows/vls.exe - GOOS=darwin GOARCH=amd64 go build -o macos/vls + cd client + mkdir out + TARGET_OS=windows TARGET_ARCH=amd64 npx vcse package -t linux-x64 -o vls-linux.vsix + rm out/* + TARGET_OS=windows TARGET_ARCH=amd64 npx vcse package -t win32-x64 -o vls-windows.vsix + rm out/* + TARGET_OS=windows TARGET_ARCH=amd64 npx vcse package -t darwin-x64 -o vls-darwin.vsix - name: Upload Linux Artifact uses: actions/upload-artifact@v3 with: name: vls-linux-amd64 - path: server/linux/vls + path: client/vls-linux.vsix - name: Upload Windows Artifact uses: actions/upload-artifact@v3 with: name: vls-windows-amd64 - path: server/windows/vls.exe + path: client/vls-windows.vsix - name: Upload Darwin Artifact uses: actions/upload-artifact@v3 with: name: vls-darwin-amd64 - path: server/macos/vls + path: client/vls-macos.vsix diff --git a/client/build.mjs b/client/build.mjs index 2f20da4..bd56e96 100644 --- a/client/build.mjs +++ b/client/build.mjs @@ -6,7 +6,7 @@ import * as process from "process"; import { fileURLToPath } from 'url'; function getExecutableFilename(basename) { - if (process.platform == "win32") { + if (process.env["GOOS"] == "windows") { return basename + ".exe"; } else { return basename; @@ -19,12 +19,15 @@ const dirname = path.dirname(filename); // cd to repository root process.chdir(path.join(dirname, "..")); +// Misc resource files fsp.copyFile("README.md", path.join("client", "README.md")); fsp.copyFile("LICENSE", path.join("client", "LICENSE")); const goBuild = spawn( "go", ["build", "-o", path.resolve("client", "bin", getExecutableFilename("verilog_language_server"))], + // Target OS and architecture should be specified to the node process running this script, e.g. + // bash -c 'GOOS=windows GOARCH=amd64 node build.mjs' { cwd: "server" }, ); goBuild.on('exit', exitCode => {