|
6 | 6 | tags: ['v*'] |
7 | 7 | pull_request: |
8 | 8 | branches: [main] |
9 | | - |
| 9 | + release: |
| 10 | + types: |
| 11 | + - published |
10 | 12 | jobs: |
11 | 13 | build: |
12 | 14 | strategy: |
13 | 15 | matrix: |
14 | 16 | os: [ubuntu-latest, macos-latest] |
15 | 17 | runs-on: ${{ matrix.os }} |
| 18 | + outputs: |
| 19 | + vsixPath: ${{ steps.packageExtension.outputs.vsixPath }} |
16 | 20 | steps: |
17 | 21 | - name: Checkout |
18 | | - uses: actions/checkout@v3 |
19 | | - |
| 22 | + uses: actions/checkout@v6 |
20 | 23 | - name: Install Node.js |
21 | | - uses: actions/setup-node@v3 |
| 24 | + uses: actions/setup-node@v6 |
22 | 25 | with: |
23 | 26 | node-version: 22 |
24 | | - |
25 | 27 | - name: Install dependencies |
26 | | - run: npm install |
27 | | - |
| 28 | + run: npm ci |
28 | 29 | - name: Run lint |
29 | 30 | run: npm run lint |
30 | | - |
31 | 31 | - name: Run tests |
32 | 32 | run: npm test |
33 | 33 | if: runner.os == 'macOS' |
34 | | - |
35 | 34 | - name: Run tests (Linux) |
36 | 35 | run: xvfb-run -a npm test |
37 | 36 | if: runner.os == 'Linux' |
38 | | - |
39 | | - - name: Package extension |
40 | | - run: npx vsce package |
| 37 | + - name: Package Extension |
| 38 | + id: packageExtension |
| 39 | + uses: HaaLeo/publish-vscode-extension@v2 |
| 40 | + with: |
| 41 | + pat: stub |
| 42 | + dryRun: true |
| 43 | + - name: Upload Extension Package as Artifact |
| 44 | + uses: actions/upload-artifact@v7 |
| 45 | + with: |
| 46 | + name: ${{ matrix.os }} |
| 47 | + path: ${{ steps.packageExtension.outputs.vsixPath }} |
41 | 48 |
|
42 | 49 | publish: |
43 | 50 | runs-on: ubuntu-latest |
44 | 51 | needs: build |
45 | | - if: success() && startsWith(github.ref, 'refs/tags/') |
| 52 | + if: github.event_name == 'release' |
46 | 53 | steps: |
47 | 54 | - name: Checkout |
48 | | - uses: actions/checkout@v3 |
49 | | - |
| 55 | + uses: actions/checkout@v6 |
50 | 56 | - name: Install Node.js |
51 | | - uses: actions/setup-node@v3 |
| 57 | + uses: actions/setup-node@v6 |
52 | 58 | with: |
53 | 59 | node-version: 22 |
54 | | - |
55 | 60 | - name: Install dependencies |
56 | | - run: npm install |
57 | | - |
58 | | - - name: Publish |
59 | | - run: npx vsce publish -p ${{ secrets.VSCE_PAT }} |
| 61 | + run: npm ci |
| 62 | + - name: GitHub Release |
| 63 | + uses: softprops/action-gh-release@v2.5.0 |
| 64 | + with: |
| 65 | + generate_release_notes: true |
| 66 | + body: | |
| 67 | + # Summary |
| 68 | + See [changelog](https://github.com/asux/vscode-rspec-focus/blob/main/CHANGELOG.md#changelog) |
| 69 | + name: ${{ github.ref_name }} |
| 70 | + fail_on_unmatched_files: true |
| 71 | + files: ${{ needs.build.outputs.vsixPath }} |
| 72 | + - name: Publish to Open VSX Registry |
| 73 | + uses: HaaLeo/publish-vscode-extension@v2 |
| 74 | + id: publishToOpenVSX |
| 75 | + with: |
| 76 | + pat: ${{ secrets.OVSX_PAT }} |
| 77 | + extensionFile: ${{ needs.build.outputs.vsixPath }} |
| 78 | + - name: Publish to Visual Studio Marketplace |
| 79 | + uses: HaaLeo/publish-vscode-extension@v2 |
| 80 | + with: |
| 81 | + pat: ${{ secrets.VSCE_PAT }} |
| 82 | + registryUrl: https://marketplace.visualstudio.com |
| 83 | + extensionFile: ${{ needs.build.outputs.vsixPath }} |
0 commit comments