Skip to content

Commit b86ed5f

Browse files
authored
Create publish.yml (#1255)
1 parent 79efc82 commit b86ed5f

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/publish.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish VSIX to VSCode & Open VSX (Manual)
2+
3+
# This workflow:
4+
# - Is manually triggered from GitHub Actions tab
5+
# - Downloads the .vsix from the specified release tag
6+
# - Publishes it to:
7+
# • Visual Studio Marketplace (via vsce)
8+
# • Open VSX Registry (via ovsx)
9+
# - Supports dry run mode (no actual publish unless dry_run == false)
10+
11+
on:
12+
workflow_dispatch:
13+
inputs:
14+
tag:
15+
description: 'GitHub release tag to publish (e.g., v1.2.3)'
16+
required: true
17+
type: string
18+
dry_run:
19+
description: 'Dry run (do not publish)?'
20+
required: false
21+
default: 'true'
22+
type: boolean
23+
24+
jobs:
25+
publish:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout repo
30+
uses: actions/checkout@v3
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 20
36+
37+
- name: Install GitHub CLI
38+
uses: cli/gh-action@v2
39+
40+
- name: Validate release tag and asset
41+
run: |
42+
if ! gh release view ${{ github.event.inputs.tag }} > /dev/null 2>&1; then
43+
echo "❌ Release tag '${{ github.event.inputs.tag }}' not found."
44+
exit 1
45+
fi
46+
47+
gh release download ${{ github.event.inputs.tag }} \
48+
--pattern "*.vsix" \
49+
--dir ./
50+
51+
if ! ls *.vsix 1> /dev/null 2>&1; then
52+
echo "❌ No .vsix file found in release '${{ github.event.inputs.tag }}'."
53+
exit 1
54+
fi
55+
env:
56+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Install vsce and ovsx
59+
run: yarn global add vsce ovsx
60+
61+
- name: Publish to VSCode Marketplace
62+
run: |
63+
echo "▶️ vsce publish --packagePath *.vsix"
64+
if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then
65+
vsce publish --packagePath *.vsix
66+
fi
67+
env:
68+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
69+
70+
- name: Publish to Open VSX
71+
run: |
72+
echo "▶️ ovsx publish *.vsix"
73+
if [ "${{ github.event.inputs.dry_run }}" = "false" ]; then
74+
ovsx publish *.vsix
75+
fi
76+
env:
77+
OVSX_PAT: ${{ secrets.OVSX_PAT }}

0 commit comments

Comments
 (0)