Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish

# Publishes an existing GitHub release to the VS Code Marketplace and Open VSX.
# It ships the exact .vsix attached to the release, after checking its sha256,
# so a store listing always matches an accepted, tagged build.

on:
workflow_dispatch:
inputs:
tag:
description: Release tag to publish, for example v0.3.0
required: true

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
env:
TAG: ${{ inputs.tag }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Download and verify the release package
id: vsix
run: |
VSIX="sf-vscode-${TAG#v}.vsix"
gh release download "$TAG" --pattern "$VSIX" --pattern "$VSIX.sha256"
sha256sum -c "$VSIX.sha256"
echo "path=$VSIX" >> "$GITHUB_OUTPUT"
echo "publisher=$(node -p "require('./package.json').publisher")" >> "$GITHUB_OUTPUT"
- name: Require at least one store token
if: env.VSCE_PAT == '' && env.OVSX_PAT == ''
run: |
echo "::error::Neither VSCE_PAT nor OVSX_PAT is set."
exit 1
- name: Publish to the VS Code Marketplace
if: env.VSCE_PAT != ''
run: npx --yes @vscode/vsce@3.2.2 publish --packagePath "${{ steps.vsix.outputs.path }}" --pat "$VSCE_PAT"
- name: Ensure the Open VSX namespace
if: env.OVSX_PAT != ''
run: |
out=$(npx --yes ovsx@1.3.0 create-namespace "${{ steps.vsix.outputs.publisher }}" --pat "$OVSX_PAT" 2>&1) && echo "$out" || {
echo "$out"
echo "$out" | grep -qi 'already exists' || exit 1
}
- name: Publish to Open VSX
if: env.OVSX_PAT != ''
run: npx --yes ovsx@1.3.0 publish "${{ steps.vsix.outputs.path }}" --pat "$OVSX_PAT"
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ Publishing happens only after the owner accepts a release.
4. It publishes to the VS Code Marketplace only when the `VSCE_PAT` secret is
set, and to Open VSX only when `OVSX_PAT` is set; otherwise it skips the
step with a notice. The Marketplace publisher is `SIMAI`.
5. To publish a release that already exists on GitHub (for example after the
store tokens were added), run `.github/workflows/publish.yml` by hand:

```sh
gh workflow run publish.yml -R simai/ui-vscode -f tag=v0.3.0
```

It downloads the release `.vsix`, checks it against the attached sha256,
creates the Open VSX namespace if it is missing, and publishes that exact
file. Nothing is rebuilt.

## Versioning

Expand Down
Loading