Skip to content

Commit b08ee36

Browse files
committed
feat: Package the extension.
1 parent 146cda4 commit b08ee36

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

.github/workflows/package.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Package Extension
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
NODE_VERSION: 22.x
12+
13+
permissions:
14+
contents: read
15+
packages: read
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
package:
23+
name: Build & Package Extension
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 20
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
32+
with:
33+
cache: 'npm'
34+
node-version: ${{ env.NODE_VERSION }}
35+
registry-url: 'https://npm.pkg.github.com'
36+
scope: '@deepnote'
37+
38+
- name: Install dependencies
39+
run: npm ci --prefer-offline --no-audit
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Build extension
44+
run: npm run build
45+
46+
- name: Extract version from package.json
47+
id: package-version
48+
run: |
49+
VERSION=$(node -p "require('./package.json').version")
50+
echo "version=$VERSION" >> $GITHUB_OUTPUT
51+
echo "Extension version: $VERSION"
52+
53+
- name: Extract and sanitize branch name
54+
id: branch-name
55+
run: |
56+
# Get branch name from ref
57+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
58+
BRANCH="${{ github.head_ref }}"
59+
else
60+
BRANCH="${GITHUB_REF#refs/heads/}"
61+
fi
62+
# Sanitize branch name for filename (replace / with -)
63+
SAFE_BRANCH=$(echo "$BRANCH" | sed 's/\//-/g')
64+
echo "branch=$SAFE_BRANCH" >> $GITHUB_OUTPUT
65+
echo "Branch name: $BRANCH (sanitized: $SAFE_BRANCH)"
66+
67+
- name: Package extension
68+
run: npm run package
69+
70+
- name: Rename VSIX file
71+
run: |
72+
# The package script creates ms-toolsai-jupyter-insiders.vsix
73+
# Rename it to include version and branch
74+
mv ms-toolsai-jupyter-insiders.vsix "vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }}.vsix"
75+
ls -lh *.vsix
76+
77+
- name: Upload VSIX artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }}
81+
path: vscode-deepnote-*.vsix
82+
retention-days: 30
83+
if-no-files-found: error
84+
85+
- name: Add summary
86+
run: |
87+
echo "## 📦 Extension Packaged Successfully" >> $GITHUB_STEP_SUMMARY
88+
echo "" >> $GITHUB_STEP_SUMMARY
89+
echo "**Version:** ${{ steps.package-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
90+
echo "**Branch:** ${{ steps.branch-name.outputs.branch }}" >> $GITHUB_STEP_SUMMARY
91+
echo "" >> $GITHUB_STEP_SUMMARY
92+
echo "### Installation Instructions" >> $GITHUB_STEP_SUMMARY
93+
echo "1. Download the artifact from the Actions tab" >> $GITHUB_STEP_SUMMARY
94+
echo "2. Extract the .vsix file from the zip" >> $GITHUB_STEP_SUMMARY
95+
echo "3. Install in VS Code:" >> $GITHUB_STEP_SUMMARY
96+
echo " - Open VS Code" >> $GITHUB_STEP_SUMMARY
97+
echo " - Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)" >> $GITHUB_STEP_SUMMARY
98+
echo " - Click the '...' menu → 'Install from VSIX...'" >> $GITHUB_STEP_SUMMARY
99+
echo " - Select the downloaded .vsix file" >> $GITHUB_STEP_SUMMARY
100+
echo "" >> $GITHUB_STEP_SUMMARY
101+
echo "Alternatively, use the command line:" >> $GITHUB_STEP_SUMMARY
102+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
103+
echo "code --install-extension vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }}.vsix" >> $GITHUB_STEP_SUMMARY
104+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)