Skip to content

Publish VSCode Extension #11

Publish VSCode Extension

Publish VSCode Extension #11

name: Publish VSCode Extension
on:
workflow_dispatch:
jobs:
build-linux-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Rust and Cargo
uses: dtolnay/rust-toolchain@stable
- name: Install cross-compilation targets
run: |
rustup target add x86_64-pc-windows-gnu x86_64-apple-darwin x86_64-unknown-linux-gnu
sudo apt-get update && sudo apt-get install -y mingw-w64
- name: Compile executables
run: |
cargo build --target x86_64-pc-windows-gnu
cargo build --target x86_64-unknown-linux-gnu
- name: Archive executables
run: |
mkdir -p artifacts/server/windows
mkdir -p artifacts/server/linux
mv target/x86_64-pc-windows-gnu/debug/asp-lsp.exe artifacts/server/windows/asp-lsp.exe
mv target/x86_64-unknown-linux-gnu/debug/asp-lsp artifacts/server/linux/asp-lsp
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-windows-executables
path: artifacts/server
build-macos:
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Rust and Cargo
uses: dtolnay/rust-toolchain@stable
- name: Install macOS target
run: rustup target add x86_64-apple-darwin
- name: Compile macOS executable
run: cargo build --target x86_64-apple-darwin
- name: Archive macOS executable
run: |
mkdir -p artifacts/server/macos
mv target/x86_64-apple-darwin/debug/asp-lsp artifacts/server/macos/asp-lsp
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-executable
path: artifacts/server
build-extension:
runs-on: ubuntu-latest
needs: [build-linux-windows, build-macos]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Linux and Windows artifacts
uses: actions/download-artifact@v4
with:
name: linux-windows-executables
path: editors/vscode/server
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: macos-executable
path: editors/vscode/server
- name: Install npm packages
working-directory: editors/vscode
run: npm install
- name: Build Extension
working-directory: editors/vscode
run: npm run build
- name: Set executable permissions
run: |
chmod +x editors/vscode/server/linux/asp-lsp
chmod +x editors/vscode/server/macos/asp-lsp
- name: Install vsce for publishing
working-directory: editors/vscode
run: npm install -g vsce
- name: Publish Extension
working-directory: editors/vscode
run: vsce publish -p ${{ secrets.VSCODE_TOKEN }}