Compare commits

...

13 Commits

Author SHA1 Message Date
BarreiroT 7b5c7e69c6 temp - use the ubuntu latest runner and remove dependency on tests 2025-09-05 15:04:17 +02:00
BarreiroT f1a8d4371f temp - Add current branch to build 2025-09-05 14:51:53 +02:00
BarreiroT 134b9e16ab Add permissions to the build 2025-09-05 14:51:53 +02:00
BarreiroT 0376eb2c6f Conditionally select a runner 2025-09-05 14:51:53 +02:00
BarreiroT ea663cb3e7 add if check to only run in the Cline repo 2025-09-05 14:51:53 +02:00
BarreiroT 17fe066e06 Use high capacity runner 2025-09-05 14:51:53 +02:00
Dennise Bartlett 82080cf5b1 Update package.json
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-05 14:51:53 +02:00
BarreiroT 99167c52fa use while true; 2025-09-05 14:51:53 +02:00
BarreiroT a671e0c59e Remove test trigger 2025-09-05 14:51:53 +02:00
BarreiroT e1e1fad896 Remove while ; 2025-09-05 14:51:53 +02:00
BarreiroT 9e5a5ec4a2 Fix tag resolution 2025-09-05 14:51:53 +02:00
BarreiroT e94c4b03bf Publish using the vsix path 2025-09-05 14:51:53 +02:00
BarreiroT fc6d81f242 Build the extension on every commit push 2025-09-05 14:51:52 +02:00
3 changed files with 111 additions and 33 deletions
+73
View File
@@ -0,0 +1,73 @@
name: "Build Extension"
on:
push:
branches:
- main
- build-package-per-commit
permissions:
contents: write
packages: write
checks: write
pull-requests: write
jobs:
build:
name: Build Extension
runs-on: 'ubuntu-latest'
# runs-on: ${{ github.repository == 'cline/cline' && 'high-capacity-runner' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Cache root dependencies
uses: actions/cache@v4
id: root-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
- name: Cache webview-ui dependencies
uses: actions/cache@v4
id: webview-cache
with:
path: webview-ui/node_modules
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
- name: Install root dependencies
if: steps.root-cache.outputs.cache-hit != 'true'
run: npm ci --include=optional
- name: Install webview-ui dependencies
if: steps.webview-cache.outputs.cache-hit != 'true'
run: cd webview-ui && npm ci --include=optional
- name: Install Publishing Tools
run: npm install -g @vscode/vsce ovsx
- name: Set Variables
id: set_variables
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "file_path=cline-${VERSION}-${SHORT_SHA}.vsix" >> $GITHUB_OUTPUT
- name: Package Extension
run: |
echo "Packaging extension with version ${{ steps.set_variables.outputs.version }}"
vsce package --allow-package-secrets sendgrid --out "${{ steps.set_variables.outputs.file_path }}"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: vsix-package
path: ${{ steps.set_variables.outputs.file_path }}
+36 -31
View File
@@ -23,11 +23,7 @@ permissions:
pull-requests: write
jobs:
test:
uses: ./.github/workflows/test.yml
publish:
needs: test
name: Publish Extension
runs-on: ubuntu-latest
environment: publish
@@ -42,30 +38,6 @@ jobs:
with:
node-version: "lts/*"
# Cache root dependencies - only reuse if package-lock.json exactly matches
- name: Cache root dependencies
uses: actions/cache@v4
id: root-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
# Cache webview-ui dependencies - only reuse if package-lock.json exactly matches
- name: Cache webview-ui dependencies
uses: actions/cache@v4
id: webview-cache
with:
path: webview-ui/node_modules
key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }}
- name: Install root dependencies
if: steps.root-cache.outputs.cache-hit != 'true'
run: npm ci --include=optional
- name: Install webview-ui dependencies
if: steps.webview-cache.outputs.cache-hit != 'true'
run: cd webview-ui && npm ci --include=optional
- name: Install Publishing Tools
run: npm install -g @vscode/vsce ovsx
@@ -90,15 +62,48 @@ jobs:
echo "Tag '$TAG' validated successfully"
- name: Download Artifact
id: download_artifact
timeout-minutes: 30
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.event.inputs.tag }}"
COMMIT_SHA=$(git rev-parse "$TAG")
while true; do
RUN_ID=$(gh run list \
--workflow="Build Extension" \
--commit="${COMMIT_SHA}" \
--status=success \
--limit=1 \
--json databaseId \
--jq '.[0].databaseId')
if [ -n "$RUN_ID" ]; then
echo "Build completed! Downloading artifact..."
gh run download $RUN_ID --name vsix-package
exit 0
fi
echo "Waiting for build..."
sleep 10
done
- name: Set VSIX Path
id: set_vsix_path
run: |
FILE_PATH=$(ls *.vsix | head -n 1)
echo "VSIX_PATH=$FILE_PATH" >> $GITHUB_OUTPUT
- name: Package and Publish Extension
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
CLINE_ENVIRONMENT: production
VSIX_PATH: ${{ steps.set_vsix_path.outputs.VSIX_PATH }}
run: |
# Required to generate the .vsix
vsce package --allow-package-secrets sendgrid --out "cline-${{ steps.get_version.outputs.version }}.vsix"
if [ "${{ github.event.inputs.release-type }}" = "pre-release" ]; then
npm run publish:marketplace:prerelease
echo "Successfully published pre-release version ${{ steps.get_version.outputs.version }} to VS Code Marketplace and Open VSX Registry"
+2 -2
View File
@@ -363,8 +363,8 @@
"dev:webview": "cd webview-ui && npm run dev",
"build:webview": "cd webview-ui && npm run build",
"test:webview": "cd webview-ui && npm run test",
"publish:marketplace": "vsce publish --allow-package-secrets sendgrid && ovsx publish",
"publish:marketplace:prerelease": "vsce publish --allow-package-secrets sendgrid --pre-release && ovsx publish --pre-release",
"publish:marketplace": "vsce publish ${VSIX_PATH:+--packagePath $VSIX_PATH} --allow-package-secrets sendgrid && ovsx publish ${VSIX_PATH:+--packagePath $VSIX_PATH}",
"publish:marketplace:prerelease": "vsce publish --pre-release ${VSIX_PATH:+--packagePath $VSIX_PATH} --allow-package-secrets sendgrid && ovsx publish --pre-release ${VSIX_PATH:+--packagePath $VSIX_PATH}",
"prepare": "husky",
"changeset": "changeset",
"version-packages": "changeset version",