Skip to content

Commit

Permalink
feat(vscode-plugin): add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mcecode committed Sep 20, 2024
1 parent 61e7469 commit c7b4f71
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 5 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/publish_vscode_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish VS Code Plugin

on:
push:
branches: [vscode-bundle-harper-ls]
tags: ["harper-vscode*"]
workflow_dispatch:

jobs:
package:
strategy:
matrix:
platform:
- os: windows-latest
rust_target: x86_64-pc-windows-gnu
code_target: win32-x64
- os: macOS-latest
rust_target: x86_64-apple-darwin
code_target: darwin-x64
- os: macOS-latest
rust_target: aarch64-apple-darwin
code_target: darwin-arm64
- os: ubuntu-20.04
rust_target: x86_64-unknown-linux-gnu
code_target: linux-x64
- os: ubuntu-20.04
rust_target: aarch64-unknown-linux-gnu
code_target: linux-arm64
name: Package - ${{ matrix.platform.code_target }}
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Build harper-ls
uses: houseabsolute/actions-rust-cross@v0
with:
target: ${{ matrix.platform.rust_target }}
args: "--locked --release --bin harper-ls"
strip: true
- name: Package extension
shell: bash
run: |
bin_dir="packages/vscode-plugin/bin"
release_dir="target/${{ matrix.platform.rust_target }}/release"
mkdir "$bin_dir"
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
cp "${release_dir}/harper-ls.exe" "$bin_dir"
else
cp "${release_dir}/harper-ls" "$bin_dir"
fi
just package-vscode ${{ matrix.platform.code_target }}
- name: Upload extension
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.code_target }}
path: "packages/vscode-plugin/*.vsix"
11 changes: 6 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ build-obsidian:

zip harper-obsidian-plugin.zip manifest.json main.js

package-vscode:
# This assumes that `harper-ls` or `harper-ls.exe` exists in `packages/vscode-plugin/bin`.
package-vscode target:
#! /bin/bash
set -eo pipefail

path="{{justfile_directory()}}/packages/vscode-plugin"
cp LICENSE "${path}/LICENSE"
cd "$path"
ext_dir="{{justfile_directory()}}/packages/vscode-plugin"
cp LICENSE "$ext_dir"
cd "$ext_dir"

yarn install -f
yarn package
yarn package --target {{target}}

check:
#! /bin/bash
Expand Down
1 change: 1 addition & 0 deletions packages/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"endOfLine": "auto",
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
Expand Down

0 comments on commit c7b4f71

Please sign in to comment.