|
| 1 | +name: Release & Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + uses: ./.github/workflows/test.yml |
| 12 | + |
| 13 | + release: |
| 14 | + needs: test |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Setup Node.js environment |
| 21 | + uses: actions/setup-node@v4 |
| 22 | + with: |
| 23 | + node-version: 20.15.1 |
| 24 | + |
| 25 | + # Cache root dependencies - only reuse if package-lock.json exactly matches |
| 26 | + - name: Cache root dependencies |
| 27 | + uses: actions/cache@v4 |
| 28 | + id: root-cache |
| 29 | + with: |
| 30 | + path: node_modules |
| 31 | + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} |
| 32 | + |
| 33 | + # Cache webview-ui dependencies - only reuse if package-lock.json exactly matches |
| 34 | + - name: Cache webview-ui dependencies |
| 35 | + uses: actions/cache@v4 |
| 36 | + id: webview-cache |
| 37 | + with: |
| 38 | + path: webview-ui/node_modules |
| 39 | + key: ${{ runner.os }}-npm-webview-${{ hashFiles('webview-ui/package-lock.json') }} |
| 40 | + |
| 41 | + - name: Install root dependencies |
| 42 | + if: steps.root-cache.outputs.cache-hit != 'true' |
| 43 | + run: npm ci |
| 44 | + |
| 45 | + - name: Install webview-ui dependencies |
| 46 | + if: steps.webview-cache.outputs.cache-hit != 'true' |
| 47 | + run: cd webview-ui && npm ci |
| 48 | + |
| 49 | + - name: Build Extension |
| 50 | + run: npm run build |
| 51 | + |
| 52 | + - name: Install Publishing Tools |
| 53 | + run: npm install -g vsce ovsx |
| 54 | + |
| 55 | + - name: Package and Publish Extension |
| 56 | + env: |
| 57 | + VSCE_PAT: ${{ secrets.VSCE_PAT }} |
| 58 | + OVSX_PAT: ${{ secrets.OVSX_PAT }} |
| 59 | + run: | |
| 60 | + current_package_version=$(node -p "require('./package.json').version") |
| 61 | + npm run publish:marketplace |
| 62 | + echo "Successfully published version $current_package_version to VS Code Marketplace" |
| 63 | +
|
| 64 | + - name: Create GitHub Release |
| 65 | + uses: softprops/action-gh-release@v1 |
| 66 | + with: |
| 67 | + files: "*.vsix" |
| 68 | + generate_release_notes: true |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments