chore(deps): update actions/upload-artifact action to v5 #1314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| package: | |
| name: Build & Package Extension | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6 | |
| with: | |
| cache: 'npm' | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: npm ci --prefer-offline --no-audit | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Extract version from package.json | |
| id: package-version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extension version: $VERSION" | |
| - name: Extract and sanitize branch name | |
| id: branch-name | |
| env: | |
| UNTRUSTED_HEAD_REF: ${{ github.head_ref }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| # Get branch name from ref (use env vars to avoid direct interpolation) | |
| if [[ "$EVENT_NAME" == "pull_request" ]]; then | |
| BRANCH="$UNTRUSTED_HEAD_REF" | |
| else | |
| BRANCH="${GITHUB_REF#refs/heads/}" | |
| fi | |
| # Sanitize branch name for filename (replace / with -) | |
| SAFE_BRANCH=$(printf '%s' "$BRANCH" | sed 's/\//-/g') | |
| printf 'branch=%s\n' "$SAFE_BRANCH" >> "$GITHUB_OUTPUT" | |
| printf 'Branch name: %s (sanitized: %s)\n' "$BRANCH" "$SAFE_BRANCH" | |
| - name: Package extension | |
| run: npm run package | |
| - name: Rename VSIX file | |
| run: | | |
| # The package script creates vscode-deepnote-insiders.vsix | |
| # Rename it to include version and branch | |
| mv vscode-deepnote-insiders.vsix "vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }}.vsix" | |
| ls -lh *.vsix | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }} | |
| path: vscode-deepnote-*.vsix | |
| retention-days: 30 | |
| if-no-files-found: error | |
| - name: Add summary | |
| run: | | |
| echo "## 📦 Extension Packaged Successfully" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.package-version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Branch:** ${{ steps.branch-name.outputs.branch }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Installation Instructions" >> $GITHUB_STEP_SUMMARY | |
| echo "1. Download the artifact from the Actions tab" >> $GITHUB_STEP_SUMMARY | |
| echo "2. Extract the .vsix file from the zip" >> $GITHUB_STEP_SUMMARY | |
| echo "3. Install in VS Code:" >> $GITHUB_STEP_SUMMARY | |
| echo " - Open VS Code" >> $GITHUB_STEP_SUMMARY | |
| echo " - Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)" >> $GITHUB_STEP_SUMMARY | |
| echo " - Click the '...' menu → 'Install from VSIX...'" >> $GITHUB_STEP_SUMMARY | |
| echo " - Select the downloaded .vsix file" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Alternatively, use the command line:" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY | |
| echo "code --install-extension vscode-deepnote-${{ steps.package-version.outputs.version }}-${{ steps.branch-name.outputs.branch }}.vsix" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY |