Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package binaries into VS Code extension #78

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,23 @@ jobs:
npm install -g tree-sitter-cli
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3

vscode-extension:
name: Check vscode extension
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

- name: Build vscode extension
run: |
cd vscode
npm install
npm run vsix

- name: Verify PAT
run: |
npm install -g @vscode/vsce
vsce verify-pat
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
52 changes: 44 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- 'prerelease'

jobs:
build:
build-binaries:
strategy:
matrix:
name:
Expand Down Expand Up @@ -50,17 +50,16 @@ jobs:
command: build
args: --release --locked --target ${{ matrix.target }}

- name: Build vscode extension
run: |
cd vscode
npm install
npm run vsix

- name: Rename artifacts
run: |
mkdir artifacts
mv target/${{ matrix.target }}/release/zeek-language-server artifacts/zeek-language-server-${{ matrix.target }}
mv vscode/*.vsix artifacts

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: bin
path: artifacts/zeek-language-server-${{ matrix.target }}

- name: Upload Release Assets
id: upload-release-assets
Expand All @@ -71,3 +70,40 @@ jobs:
draft: false
files: |
artifacts/*

build-vscode-extension:
name: Build vscode extension
needs: build-binaries
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2

- name: Download binaries artifacts
uses: actions/download-artifact@v3
with:
path: vscode

- name: Build vscode extension
run: |
cd vscode
chmod +x bin/*
npm install
npm run vsix

- name: Upload Release Assets
id: upload-release-assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
files: |
vscode/*.vsix
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this. I was surprised that the vsix file containing all platforms is smaller than downloading a single uncompressed executable, but I guess that makes sense.

In the past I created the vsix file for upload to the vscode marketplace offline, but this new build process makes that impossible. Would you mind looking into what it takes to do this upload from CI? I can create needed tokens etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added Personal Access Token (PAT) check and publish setp into release workflow.

I did a simple test on the Publish command (it can be built and packaged successfully and request me to provide a token). Because I didn't have a token, I didn't completely test whether Publish is completely correct.


- name: Publish
run: |
cd vscode
npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
1 change: 1 addition & 0 deletions vscode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
!images/icon.png
!images/filetype-light.png
!images/filetype-dark.png
!bin
Loading