-
Notifications
You must be signed in to change notification settings - Fork 1.8k
124 lines (103 loc) · 3.78 KB
/
Copy pathrelease.yml
File metadata and controls
124 lines (103 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Release
on:
push:
branches:
- main
- release/*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Don't cancel a publish partway through!
cancel-in-progress: false
permissions: {}
jobs:
release:
environment: deploy
name: Release
runs-on: ubuntu-latest
permissions:
# To create a release, and to push branches:
contents: write
# To create/maintain the Changesets pull request
pull-requests: write
# PRs are backed by issues; this helps with stuff like reading labels/etc
issues: read
# To enable trusted publishing
id-token: write
outputs:
vscode-published: ${{ steps.vscode.outputs.published }}
published-packages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: '.node-version'
cache: yarn
- run: yarn install --immutable
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: yarn ci:version
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
- name: Note VSCode extension release
id: vscode
if: ${{ steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '"name":"vscode-graphql') }}
run: echo "published=true" >> "$GITHUB_OUTPUT"
- name: Build VSCode extension .vsix files
if: ${{ steps.vscode.outputs.published == 'true' }}
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
run: node scripts/release-vscode.mts build
- name: Attach VSCode .vsix files to GitHub Releases
if: ${{ steps.vscode.outputs.published == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
run: node scripts/release-vscode.mts attach
- name: Upload VSCode extension .vsix artifacts
if: ${{ steps.vscode.outputs.published == 'true' }}
uses: actions/upload-artifact@v4
with:
name: vscode-extensions
path: packages/vscode-graphql*/*.vsix
if-no-files-found: error
publish-vscode-extensions:
name: Publish to ${{ matrix.registry }}
needs: release
if: ${{ needs.release.outputs.vscode-published == 'true' }}
runs-on: ubuntu-latest
permissions: {}
strategy:
fail-fast: false
matrix:
include:
- registry: VSCode Marketplace
command: publish-vsce
- registry: Open VSX Registry
command: publish-ovsx
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version-file: '.node-version'
cache: yarn
- run: yarn install --immutable
- uses: actions/download-artifact@v4
with:
name: vscode-extensions
# `upload-artifact` strips the path prefix up to the first wildcard
# segment, so the artifact contains `vscode-graphql*/*.vsix` rather
# than `packages/vscode-graphql*/*.vsix`. Restore the `packages/`
# prefix here so the layout lines up with `vsixPath('vsix', …)` in
# the script.
path: vsix/packages
- name: Publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
PUBLISHED_PACKAGES: ${{ needs.release.outputs.published-packages }}
run: node scripts/release-vscode.mts ${{ matrix.command }}