-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (95 loc) · 4.76 KB
/
Copy pathrelease.yml
File metadata and controls
114 lines (95 loc) · 4.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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.