Skip to content

Commit 9fd4ef3

Browse files
committed
add automation script
1 parent 5662622 commit 9fd4ef3

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build Extension
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
concurrency:
13+
group: extension-build-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
package:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
cache: npm
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Compute CI version
34+
shell: bash
35+
run: |
36+
set -euo pipefail
37+
BASE_VERSION="$(node -p "require('./package.json').version.split('-')[0]")"
38+
CI_VERSION="${BASE_VERSION}-ci.${GITHUB_RUN_NUMBER}"
39+
node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version='${CI_VERSION}'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
40+
echo "CI_VERSION=${CI_VERSION}" >> "$GITHUB_ENV"
41+
echo "VSIX_NAME=agentic-flow-${CI_VERSION}.vsix" >> "$GITHUB_ENV"
42+
43+
- name: Build extension
44+
run: npm run compile
45+
46+
- name: Package VSIX
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
mkdir -p dist
51+
npx @vscode/vsce package --out "dist/${VSIX_NAME}"
52+
53+
- name: Upload workflow artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ${{ env.VSIX_NAME }}
57+
path: dist/${{ env.VSIX_NAME }}
58+
if-no-files-found: error
59+
60+
- name: Publish prerelease on main
61+
if: github.ref == 'refs/heads/main'
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
tag_name: latest-build
65+
name: Latest Build
66+
prerelease: true
67+
make_latest: false
68+
target_commitish: ${{ github.sha }}
69+
files: dist/${{ env.VSIX_NAME }}
70+
body: |
71+
Automated extension build from `${{ github.sha }}`.
72+
73+
Version: `${{ env.CI_VERSION }}`
74+
Branch: `${{ github.ref_name }}`
75+
Commit: `${{ github.event.head_commit.message }}`

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ npm run dev:host:workspace
198198
npm run package
199199
```
200200

201+
## CI / Releases
202+
203+
- Every push builds and packages a `.vsix` in GitHub Actions as a downloadable workflow artifact
204+
- Pushes to `main` also refresh the GitHub prerelease `latest-build` with the newest `.vsix`
205+
- CI rewrites the extension version only inside the runner to a unique prerelease form like `1.0.0-ci.42`, so each generated build is installable as a distinct package
206+
201207
---
202208

203209
## License

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
"compile": "tsc -p ./",
195195
"watch": "tsc -watch -p ./",
196196
"package": "vsce package",
197+
"package:ci": "vsce package --out dist/agentic-flow.vsix",
197198
"dev:host": "code . --new-window --extensionDevelopmentPath=. --user-data-dir ./.vscode-test/user-data --extensions-dir ./.vscode-test/extensions",
198199
"dev:host:insiders": "code-insiders . --new-window --extensionDevelopmentPath=. --user-data-dir ./.vscode-test/user-data --extensions-dir ./.vscode-test/extensions",
199200
"dev:host:workspace": "mkdir -p ./.vscode-test/workspace && code ./.vscode-test/workspace --new-window --extensionDevelopmentPath=. --user-data-dir ./.vscode-test/user-data --extensions-dir ./.vscode-test/extensions"

0 commit comments

Comments
 (0)