Skip to content

rename

rename #711

Workflow file for this run

name: VSCode Extension
on:
pull_request:
paths:
- "typescript/**"
# Or if any rust code changes
- "engine/**"
branches:
- canary
push:
paths:
- "typescript/.bumpversion.cfg"
branches:
- canary
tags:
- "release/vscode_ext/v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
engine
- name: Setup
run: rustup target add wasm32-unknown-unknown
- name: Bindgen
run: cargo update -p wasm-bindgen
working-directory: engine/baml-schema-wasm
- name: Install Bindgen
run: cargo install -f [email protected]
working-directory: engine/baml-schema-wasm
- name: Install Rust
run: cargo build --release --all-features
working-directory: engine/baml-schema-wasm
- uses: pnpm/action-setup@v3
with:
version: 8
package_json_file: typescript/package.json
run_install: false
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18
cache-dependency-path: typescript/pnpm-lock.yaml
- name: Install Dependencies
run: pnpm install --frozen-lockfile
working-directory: typescript/
- name: Build Deps
run: pnpm run build
working-directory: typescript/
# Build the VSCode Extension
- name: Build VSCode Extension
id: build
run: |
pnpm run vscode:package
VERSION=$(cat package.json| grep version | cut -d ' ' -f 4 | sed 's/[",]//g')
echo "version=$VERSION" >> $GITHUB_OUTPUT
working-directory: typescript/vscode-ext/packages
# Upload the artifact (helpful for debugging and manual downloads)
- name: Upload VSCode Extension Artifact
uses: actions/upload-artifact@v4
with:
name: baml-vscode.vsix
path: typescript/vscode-ext/packages/baml-${{ steps.build.outputs.version }}.vsix
# Upload the artifact (helpful for debugging and manual downloads)
- name: Upload VSCode Extension Artifact
uses: actions/upload-artifact@v4
with:
name: baml-out
path: typescript/vscode-ext/packages/vscode/out
# upload the lang server artifact
- name: Upload VSCode Lang Server Extension Artifact
uses: actions/upload-artifact@v4
with:
name: language-server
path: typescript/vscode-ext/packages/language-server/out
- name: VSCode Playground Artifact
uses: actions/upload-artifact@v4
with:
name: vscode-playground
path: typescript/vscode-ext/packages/web-panel/dist
pre-release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/canary'
environment: nightly
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: baml-vscode.vsix
path: typescript/vscode-ext/packages
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: baml-out
path: typescript/vscode-ext/packages/vscode/out
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: language-server
path: typescript/vscode-ext/packages/language-server/out
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: vscode-playground
path: typescript/vscode-ext/packages/web-panel/dist
- id: hash
run: |
VERSION=$(cat typescript/.bumpversion.cfg | grep current_version | cut -d '=' -f 2 | sed 's/[", ]//g')
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]*[02468]\.[0-9]+$ ]]; then
echo "Version ($VERSION) is not a pre-release build (minor must be even)"
exit 1
fi
echo "version=$(echo $VERSION | cut -d '-' -f 1)" >> $GITHUB_OUTPUT
echo "full_version=$VERSION" >> $GITHUB_OUTPUT
echo "vsix_hash=$(shasum -a 256 typescript/vscode-ext/packages/baml-${echo $VERSION | cut -d '-' -f 1}.vsix | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: Pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: "unstable/vscode_ext/v${{ steps.hash.outputs.version }}"
files: |
typescript/vscode-ext/packages/baml-${{ steps.hash.outputs.version }}.vsix
prerelease: true
body: |
## Hashes
Full Version: ${{ steps.hash.outputs.full_version }}
VSIX: ${{ steps.hash.outputs.vsix_hash }}
- uses: pnpm/action-setup@v3
with:
version: 8
package_json_file: typescript/package.json
run_install: false
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18
cache-dependency-path: typescript/pnpm-lock.yaml
- name: Install Dependencies
run: pnpm install --frozen-lockfile
working-directory: typescript/
- name: Publish
run: |
pnpm run vscode:publish --pre-release --no-git-tag-version -p ${{ secrets.VSCODE_PAT }}
working-directory: typescript/vscode-ext/packages
release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/release/')
environment: release
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: baml-vscode.vsix
path: typescript/vscode-ext/packages/
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: baml-out
path: typescript/vscode-ext/packages/vscode/out
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: language-server
path: typescript/vscode-ext/packages/language-server/out
- name: Get artifact
uses: actions/download-artifact@v4
with:
name: vscode-playground
path: typescript/vscode-ext/packages/web-panel/dist
- id: hash
run: |
VERSION=$(cat typescript/.bumpversion.cfg | grep current_version | cut -d '=' -f 2 | sed 's/[", ]//g')
echo "version=$(echo $VERSION | cut -d '-' -f 1)" >> $GITHUB_OUTPUT
echo "full_version=$VERSION" >> $GITHUB_OUTPUT
echo "vsix_hash=$(shasum -a 256 typescript/vscode-ext/packages/baml-${echo $VERSION | cut -d '-' -f 1}.vsix | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
- name: Pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: "unstable/vscode_ext/v${{ steps.hash.outputs.version }}"
files: |
typescript/vscode-ext/packages/baml-${{ steps.hash.outputs.version }}.vsix
prerelease: true
body: |
## Hashes
Full Version: ${{ steps.hash.outputs.full_version }}
VSIX: ${{ steps.hash.outputs.vsix_hash }}
- uses: pnpm/action-setup@v3
with:
version: 8
package_json_file: typescript/package.json
run_install: false
# Set up Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18
cache-dependency-path: typescript/pnpm-lock.yaml
- name: Install Dependencies
run: pnpm install --frozen-lockfile
working-directory: typescript/
- name: Publish
run: |
pnpm run vscode:publish --no-git-tag-version -p ${{ secrets.VSCODE_PAT }}
working-directory: typescript/vscode-ext/packages