Skip to content

Commit c616c38

Browse files
committed
Build the extension on every commit push
1 parent 037a781 commit c616c38

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Build Extension"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- build-package-per-commit
8+
9+
jobs:
10+
test:
11+
uses: ./.github/workflows/test.yml
12+
build:
13+
needs: test
14+
name: Build Extension
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "lts/*"
24+
25+
- name: Cache root dependencies
26+
uses: actions/cache@v4
27+
id: root-cache
28+
with:
29+
path: node_modules
30+
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
31+
32+
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
33+
- name: Cache webview-ui dependencies
34+
uses: actions/cache@v4
35+
id: webview-cache
36+
with:
37+
path: webview-ui/node_modules
38+
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
39+
40+
- name: Install root dependencies
41+
if: steps.root-cache.outputs.cache-hit != 'true'
42+
run: npm ci --include=optional
43+
44+
- name: Install webview-ui dependencies
45+
if: steps.webview-cache.outputs.cache-hit != 'true'
46+
run: cd webview-ui && npm ci --include=optional
47+
48+
- name: Install Publishing Tools
49+
run: npm install -g @vscode/vsce ovsx
50+
51+
- name: Set Variables
52+
id: set_variables
53+
run: |
54+
VERSION=$(node -p "require('./package.json').version")
55+
echo "version=$VERSION" >> $GITHUB_OUTPUT
56+
SHORT_SHA=$(git rev-parse --short HEAD)
57+
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
58+
echo "file_path=cline-${VERSION}-${SHORT_SHA}.vsix" >> $GITHUB_OUTPUT
59+
60+
- name: Package Extension
61+
run: |
62+
echo "Packaging extension with version ${{ steps.set_variables.outputs.version }}"
63+
vsce package --out "${{ steps.set_variables.outputs.file_path }}"
64+
65+
- name: Upload Artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: vsix-package
69+
path: ${{ steps.set_variables.outputs.file_path }}

0 commit comments

Comments
 (0)