Skip to content

feat: add verification script for production bundle and update build … #11

feat: add verification script for production bundle and update build …

feat: add verification script for production bundle and update build … #11

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]*" # v1.0.0, v1.2.3, etc.
workflow_dispatch: # Allows manual release triggering
jobs:
build-and-release:
name: Build, Test, and Release
runs-on: ubuntu-latest
permissions:
contents: write # required to create GitHub Releases
steps:
# ── 1. Source ──────────────────────────────────────────────────────────
- name: Checkout
uses: actions/checkout@v4
# ── 2. Node ────────────────────────────────────────────────────────────
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
# ── 3. Version from tag ────────────────────────────────────────────────
- name: Extract version
id: ver
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "VSIX=vscode-ts-chef-${VERSION}.vsix" >> "$GITHUB_OUTPUT"
- name: Sync version in package.json
run: |
CURRENT=$(node -p "require('./package.json').version")
TARGET="${{ steps.ver.outputs.VERSION }}"
if [ "$CURRENT" != "$TARGET" ]; then
npm version "$TARGET" --no-git-tag-version
echo "Bumped $CURRENT → $TARGET"
else
echo "package.json already at $TARGET, nothing to do"
fi
# ── 4. Install & Test ──────────────────────────────────────────────────
- name: Install dependencies
run: npm ci
- name: Run Lint
run: npm run lint
- name: Run Tests
run: npm test
# ── 5. Build ───────────────────────────────────────────────────────────
- name: Build extension
run: npm run build
- name: Generate API Documentation
run: npm run docs
# ── 6. Package ─────────────────────────────────────────────────────────
- name: Package VSIX
run: |
npx --yes @vscode/vsce package \
--no-dependencies \
--out "${{ steps.ver.outputs.VSIX }}"
- name: Zip Documentation
run: |
cd docs/api
zip -r ../../ts-chef-docs-${{ steps.ver.outputs.VERSION }}.zip .
cd ../..
- name: Show VSIX & Docs info
run: |
echo "── VSIX ──────────────────────────────────"
ls -lh "${{ steps.ver.outputs.VSIX }}"
echo "── Docs ──────────────────────────────────"
ls -lh "ts-chef-docs-${{ steps.ver.outputs.VERSION }}.zip"
# ── 7. GitHub Release ─────────────────────────────────────────────────
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "ts-chef ${{ github.ref_name }}"
tag_name: ${{ github.ref_name }}
files: |
${{ steps.ver.outputs.VSIX }}
ts-chef-docs-${{ steps.ver.outputs.VERSION }}.zip
prerelease: ${{ contains(github.ref_name, '-') }}
body: |
## ts-chef ${{ github.ref_name }}
### Install Extension
1. Download **`${{ steps.ver.outputs.VSIX }}`** from the assets below.
2. In VS Code: **Extensions** (⇧⌘X) → **⋯** → **Install from VSIX…**
Or via Command Line:
```bash
code --install-extension ${{ steps.ver.outputs.VSIX }}
```
### Documentation
* Download **`ts-chef-docs-${{ steps.ver.outputs.VERSION }}.zip`** to view the full API documentation offline. Extract the archive and open `index.html` in your browser.
---
> ⚠️ Early development — bugs possible. Please [open an issue](../../issues/new) if something breaks.