|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + # Only run if this is a merge commit (PR merge) and contains version bump |
| 13 | + if: contains(github.event.head_commit.message, 'chore: bump version to v') |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Extract version from commit message |
| 22 | + id: extract-version |
| 23 | + uses: actions-ecosystem/action-regex-match@v2 |
| 24 | + with: |
| 25 | + text: ${{ github.event.head_commit.message }} |
| 26 | + regex: 'chore: bump version to v([\d.]+)' |
| 27 | + flags: gm |
| 28 | + |
| 29 | + - name: Setup Node.js |
| 30 | + uses: actions/setup-node@v4 |
| 31 | + with: |
| 32 | + node-version: '22.x' |
| 33 | + |
| 34 | + - name: Setup pnpm |
| 35 | + uses: pnpm/action-setup@v4 |
| 36 | + |
| 37 | + - name: Get pnpm store directory |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 41 | +
|
| 42 | + - name: Setup pnpm cache |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: ${{ env.STORE_PATH }} |
| 46 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-pnpm-store- |
| 49 | +
|
| 50 | + - name: Install dependencies |
| 51 | + run: pnpm install --frozen-lockfile |
| 52 | + |
| 53 | + - name: Run tests |
| 54 | + run: xvfb-run -a pnpm test |
| 55 | + env: |
| 56 | + CI: true |
| 57 | + |
| 58 | + - name: Build extension |
| 59 | + run: pnpm run build |
| 60 | + |
| 61 | + - name: Create Tag |
| 62 | + uses: mathieudutour/github-tag-action@v6.1 |
| 63 | + with: |
| 64 | + custom_tag: v${{ steps.extract-version.outputs.group1 }} |
| 65 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + tag_prefix: '' |
| 67 | + tag_message: 'Release v${{ steps.extract-version.outputs.group1 }}' |
| 68 | + |
| 69 | + - name: Create GitHub Release |
| 70 | + uses: softprops/action-gh-release@v2 |
| 71 | + with: |
| 72 | + tag_name: v${{ steps.extract-version.outputs.group1 }} |
| 73 | + name: Release v${{ steps.extract-version.outputs.group1 }} |
| 74 | + body: | |
| 75 | + ## Release v${{ steps.extract-version.outputs.group1 }} |
| 76 | +
|
| 77 | + Automated release created from version bump commit. |
| 78 | +
|
| 79 | + **Installation:** |
| 80 | + - Download the `.vsix` file from the assets below |
| 81 | + - Install via VS Code: `code --install-extension vscode-generic-expand-selection-${{ steps.extract-version.outputs.group1 }}.vsix` |
| 82 | + - Or install from VS Code Extensions marketplace |
| 83 | + files: | |
| 84 | + out.vsix |
| 85 | + draft: false |
| 86 | + prerelease: false |
| 87 | + |
| 88 | + - name: Publish to VS Code Marketplace |
| 89 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 90 | + with: |
| 91 | + pat: ${{ secrets.VSCE_PAT }} |
| 92 | + registryUrl: https://marketplace.visualstudio.com |
| 93 | + extensionFile: out.vsix |
0 commit comments