-
-
Notifications
You must be signed in to change notification settings - Fork 16
89 lines (76 loc) · 2.82 KB
/
Copy pathvscode-release.yml
File metadata and controls
89 lines (76 loc) · 2.82 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
name: vscode-release
# Builds, packages, and publishes the Rocky VS Code extension when a vscode-v*
# tag is pushed. Creates the GitHub Release (if it doesn't already exist),
# attaches the .vsix artifact, and publishes to the VS Code Marketplace when
# the VSCE_PAT secret is configured. scripts/release.sh remains as a local
# fallback.
on:
push:
tags: ["vscode-v*"]
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
defaults:
run:
working-directory: editors/vscode
jobs:
# Create the GitHub Release if it doesn't already exist (supports both
# CI-only releases and the local scripts/release.sh workflow where the
# release is created before the tag push).
ensure-release:
name: Ensure GitHub Release exists
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Create release if missing
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "Release $TAG already exists (created by scripts/release.sh)"
else
echo "Creating release $TAG"
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--generate-notes \
--latest=false \
--title "$TAG"
fi
build:
name: Build and publish
needs: ensure-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- run: npm ci
- run: npm run compile
- name: Package VSIX
run: npx @vscode/vsce package
- name: Attach VSIX to GitHub Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
files: editors/vscode/*.vsix
- name: Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
# `if: env.VSCE_PAT != ''` doesn't work — the `env` context isn't
# available in step-level `if:` evaluation. Guard inline instead so
# forks without the secret produce a soft no-op rather than a hard
# failure (matches the pattern documented in engine-wasm-release.yml).
run: |
if [ -z "$VSCE_PAT" ]; then
echo "VSCE_PAT not set — skipping marketplace publish (this is expected on forks)"
exit 0
fi
npx @vscode/vsce publish --pat "$VSCE_PAT"