|
31 | 31 | # To enable trusted publishing |
32 | 32 | id-token: write |
33 | 33 |
|
| 34 | + outputs: |
| 35 | + vscode-published: ${{ steps.vscode.outputs.published }} |
| 36 | + published-packages: ${{ steps.changesets.outputs.publishedPackages }} |
| 37 | + |
34 | 38 | steps: |
35 | 39 | - name: Checkout Code |
36 | 40 | uses: actions/checkout@v6 |
|
42 | 46 | node-version-file: '.node-version' |
43 | 47 | cache: yarn |
44 | 48 |
|
45 | | - - run: yarn install --frozen-lockfile --immutable |
| 49 | + - run: yarn install --immutable |
46 | 50 |
|
47 | 51 | - name: Create Release Pull Request or Publish to npm |
48 | 52 | id: changesets |
|
51 | 55 | version: yarn ci:version |
52 | 56 | # This expects you to have a script called release which does a build for your packages and calls changeset publish |
53 | 57 | publish: yarn release |
| 58 | + |
| 59 | + - name: Note VSCode extension release |
| 60 | + id: vscode |
| 61 | + if: ${{ steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '"name":"vscode-graphql') }} |
| 62 | + run: echo "published=true" >> "$GITHUB_OUTPUT" |
| 63 | + |
| 64 | + - name: Build VSCode extension .vsix files |
| 65 | + if: ${{ steps.vscode.outputs.published == 'true' }} |
| 66 | + env: |
| 67 | + PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} |
| 68 | + run: node scripts/release-vscode.mts build |
| 69 | + |
| 70 | + - name: Attach VSCode .vsix files to GitHub Releases |
| 71 | + if: ${{ steps.vscode.outputs.published == 'true' }} |
| 72 | + env: |
| 73 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 74 | + PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} |
| 75 | + run: node scripts/release-vscode.mts attach |
| 76 | + |
| 77 | + - name: Upload VSCode extension .vsix artifacts |
| 78 | + if: ${{ steps.vscode.outputs.published == 'true' }} |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: vscode-extensions |
| 82 | + path: packages/vscode-graphql*/*.vsix |
| 83 | + if-no-files-found: error |
| 84 | + |
| 85 | + publish-vscode-extensions: |
| 86 | + name: Publish to ${{ matrix.registry }} |
| 87 | + needs: release |
| 88 | + if: ${{ needs.release.outputs.vscode-published == 'true' }} |
| 89 | + runs-on: ubuntu-latest |
| 90 | + permissions: {} |
| 91 | + strategy: |
| 92 | + fail-fast: false |
| 93 | + matrix: |
| 94 | + include: |
| 95 | + - registry: VSCode Marketplace |
| 96 | + command: publish-vsce |
| 97 | + - registry: Open VSX Registry |
| 98 | + command: publish-ovsx |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v5 |
| 101 | + |
| 102 | + - uses: actions/setup-node@v6 |
| 103 | + with: |
| 104 | + node-version-file: '.node-version' |
| 105 | + cache: yarn |
| 106 | + |
| 107 | + - run: yarn install --immutable |
| 108 | + |
| 109 | + - uses: actions/download-artifact@v4 |
| 110 | + with: |
| 111 | + name: vscode-extensions |
| 112 | + # `upload-artifact` strips the path prefix up to the first wildcard |
| 113 | + # segment, so the artifact contains `vscode-graphql*/*.vsix` rather |
| 114 | + # than `packages/vscode-graphql*/*.vsix`. Restore the `packages/` |
| 115 | + # prefix here so the layout lines up with `vsixPath('vsix', …)` in |
| 116 | + # the script. |
| 117 | + path: vsix/packages |
| 118 | + |
| 119 | + - name: Publish |
54 | 120 | env: |
55 | | - # for vscode marketplace, see https://github.com/microsoft/vscode-vsce/blob/194d59b975523696362ead891dc0f3ddd277b3bd/README.md#linux |
56 | 121 | VSCE_PAT: ${{ secrets.VSCE_PAT }} |
57 | | - # for ovsx, see https://github.com/eclipse/openvsx/blob/master/cli/README.md#publish-extensions |
58 | 122 | OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }} |
| 123 | + PUBLISHED_PACKAGES: ${{ needs.release.outputs.published-packages }} |
| 124 | + run: node scripts/release-vscode.mts ${{ matrix.command }} |
0 commit comments