Skip to content

Commit e1f5a42

Browse files
authored
Publish the VS Code extension from GitHub Actions (#28)
Bump `sqlbi.sqlbi-whiteboard` to 1.0.0. A new workflow publishes that version to the Marketplace when it is not already listed. Whiteboard VersionPrefix is unchanged. Official Actions move to their Node 24 majors so the runner deprecation warning goes away.
1 parent 846bd1b commit e1f5a42

7 files changed

Lines changed: 116 additions & 13 deletions

File tree

.github/workflows/publish-site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
name: github-pages
3535
url: ${{ steps.deployment.outputs.page_url }}
3636
steps:
37-
- uses: actions/checkout@v4
37+
- uses: actions/checkout@v5
3838

3939
- uses: actions/configure-pages@v5
4040

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Publishes vscode/sqlbi-whiteboard to the Visual Studio Marketplace.
2+
#
3+
# Not the Whiteboard installer: that is signed in Azure Pipelines (decision 3).
4+
# This job needs only a Marketplace token, stored as the repository secret VSCE_PAT.
5+
#
6+
# Automatic runs fire when package.json lands on main. The job still no-ops unless
7+
# that file's version is higher than anything already on the Marketplace, so a
8+
# description-only edit of package.json does not republish 0.1.0. workflow_dispatch
9+
# is the retry path and uses the same version check.
10+
name: Publish VS Code extension
11+
12+
on:
13+
push:
14+
branches: [main]
15+
paths:
16+
- 'vscode/sqlbi-whiteboard/package.json'
17+
- '.github/workflows/publish-vscode-extension.yml'
18+
workflow_dispatch:
19+
20+
permissions:
21+
contents: read
22+
23+
concurrency:
24+
group: publish-vscode-extension
25+
cancel-in-progress: false
26+
27+
jobs:
28+
publish:
29+
name: Publish to Marketplace
30+
runs-on: ubuntu-latest
31+
defaults:
32+
run:
33+
working-directory: vscode/sqlbi-whiteboard
34+
steps:
35+
- uses: actions/checkout@v5
36+
37+
- uses: actions/setup-node@v5
38+
with:
39+
node-version: '22'
40+
cache: npm
41+
cache-dependency-path: vscode/sqlbi-whiteboard/package-lock.json
42+
43+
- name: Install, test, and package
44+
run: |
45+
npm ci
46+
npm test
47+
npx --yes @vscode/vsce package --no-update-package-json
48+
49+
- name: Decide whether this version is new
50+
id: decide
51+
run: |
52+
version=$(node -p "require('./package.json').version")
53+
echo "version=$version" >> "$GITHUB_OUTPUT"
54+
echo "vsix=sqlbi-whiteboard-${version}.vsix" >> "$GITHUB_OUTPUT"
55+
56+
if npx --yes @vscode/vsce show sqlbi.sqlbi-whiteboard --json > "$RUNNER_TEMP/published.json"; then
57+
already=$(VERSION="$version" node -e "
58+
const data = require(process.env.RUNNER_TEMP + '/published.json');
59+
const versions = (data.versions || []).map((item) => item.version);
60+
process.stdout.write(versions.includes(process.env.VERSION) ? 'yes' : 'no');
61+
")
62+
else
63+
echo "Extension is not on the Marketplace yet."
64+
already=no
65+
fi
66+
67+
if [ "$already" = "yes" ]; then
68+
echo "publish=false" >> "$GITHUB_OUTPUT"
69+
echo "sqlbi.sqlbi-whiteboard $version is already published."
70+
else
71+
echo "publish=true" >> "$GITHUB_OUTPUT"
72+
echo "Will publish sqlbi.sqlbi-whiteboard $version."
73+
fi
74+
75+
- name: Publish
76+
if: steps.decide.outputs.publish == 'true'
77+
env:
78+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
79+
run: |
80+
if [ -z "$VSCE_PAT" ]; then
81+
echo "Repository secret VSCE_PAT is missing. Create a Marketplace Manage PAT and add it as VSCE_PAT."
82+
exit 1
83+
fi
84+
npx --yes @vscode/vsce publish --packagePath "${{ steps.decide.outputs.vsix }}" --no-update-package-json --pat "$VSCE_PAT"

.github/workflows/pull-request.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
code: ${{ steps.filter.outputs.code }}
3333
vscode: ${{ steps.filter.outputs.vscode }}
3434
steps:
35-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@v5
3636
with:
3737
fetch-depth: 0
3838

@@ -61,10 +61,10 @@ jobs:
6161
needs: changes
6262
runs-on: windows-latest
6363
steps:
64-
- uses: actions/checkout@v4
64+
- uses: actions/checkout@v5
6565
if: needs.changes.outputs.code == 'true'
6666

67-
- uses: actions/setup-dotnet@v4
67+
- uses: actions/setup-dotnet@v5
6868
if: needs.changes.outputs.code == 'true'
6969
with:
7070
dotnet-version: '10.0.x'
@@ -90,10 +90,10 @@ jobs:
9090
needs: changes
9191
runs-on: windows-latest
9292
steps:
93-
- uses: actions/checkout@v4
93+
- uses: actions/checkout@v5
9494
if: needs.changes.outputs.code == 'true'
9595

96-
- uses: actions/setup-dotnet@v4
96+
- uses: actions/setup-dotnet@v5
9797
if: needs.changes.outputs.code == 'true'
9898
with:
9999
dotnet-version: '10.0.x'
@@ -130,10 +130,10 @@ jobs:
130130
needs: changes
131131
runs-on: ubuntu-latest
132132
steps:
133-
- uses: actions/checkout@v4
133+
- uses: actions/checkout@v5
134134
if: needs.changes.outputs.vscode == 'true'
135135

136-
- uses: actions/setup-node@v4
136+
- uses: actions/setup-node@v5
137137
if: needs.changes.outputs.vscode == 'true'
138138
with:
139139
node-version: '22'

docs/release-management.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,37 @@ Colours live in two places that must be changed together: the SVG, and
7070

7171
## Pull request validation
7272

73-
`.github/workflows/pull-request.yml` runs on every pull request against `main`, in two jobs:
73+
`.github/workflows/pull-request.yml` runs on every pull request against `main`:
7474

7575
- **Build and test** — restores, builds the solution in Release, and runs the Core smoke
7676
tests. `TreatWarningsAsErrors` means a warning fails it.
7777
- **Build installers** — runs `scripts/build-installer.ps1` unsigned, so WiX authoring
7878
errors surface here rather than at release time. The output is discarded.
79+
- **VS Code extension** — compiles and tests `vscode/sqlbi-whiteboard` when that tree
80+
changed.
7981

8082
It signs nothing and publishes nothing. Everything that touches the certificate stays in
8183
Azure Pipelines, because this repository is public and so are these logs (decision 3).
8284

8385
Running on GitHub also means it works for pull requests from forks, which have no access to
8486
secrets and need none.
8587

88+
## VS Code extension publishing
89+
90+
`.github/workflows/publish-vscode-extension.yml` publishes `vscode/sqlbi-whiteboard` to
91+
the Visual Studio Marketplace as `sqlbi.sqlbi-whiteboard`. It does not touch the EV
92+
certificate.
93+
94+
It runs on a push to `main` that changes that extension's `package.json`, and on
95+
**Run workflow**. It packages, then publishes only when `package.json` `version` is not
96+
already on the Marketplace. Bump that version in a pull request to ship; do not let CI
97+
rewrite it.
98+
99+
The repository secret `VSCE_PAT` must be a Marketplace **Manage** personal access token
100+
with organization **All accessible organizations**. Create it in the Azure DevOps
101+
organization tied to the `sqlbi` publisher, then add it under the GitHub repo
102+
**Settings → Secrets and variables → Actions**.
103+
86104
## The pipeline
87105

88106
`.azure/pipelines/build-whiteboard.yaml`, in the `SQLBI Whiteboard` Azure DevOps project.

vscode/sqlbi-whiteboard/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Then **Run > Start Debugging** in VS Code with this folder as the workspace, or
1818

1919
```powershell
2020
npx --yes @vscode/vsce package
21-
code --install-extension sqlbi-whiteboard-0.1.0.vsix
21+
code --install-extension sqlbi-whiteboard-1.0.0.vsix
2222
```
2323

2424
## Use

vscode/sqlbi-whiteboard/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode/sqlbi-whiteboard/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sqlbi-whiteboard",
33
"displayName": "SQLBI Whiteboard",
44
"description": "Opens .wboard files as the embedded preview image instead of a ZIP archive.",
5-
"version": "0.1.0",
5+
"version": "1.0.0",
66
"publisher": "sqlbi",
77
"license": "MIT",
88
"engines": {
@@ -43,6 +43,7 @@
4343
]
4444
},
4545
"scripts": {
46+
"vscode:prepublish": "npm run compile",
4647
"compile": "tsc -p .",
4748
"watch": "tsc -watch -p .",
4849
"test": "npm run compile && node --test out/extractPreview.test.js"

0 commit comments

Comments
 (0)