-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (125 loc) · 4.43 KB
/
Copy pathvscode-extension.yml
File metadata and controls
149 lines (125 loc) · 4.43 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: VSCode Extension
on:
# Tag pushes trigger the full validate + publish pipeline.
push:
tags:
- 'vscode-forge/v*.*.*'
- 'vscode-forge/v*.*.*-*'
# PRs touching the extension trigger validation only.
pull_request:
branches: [main, develop]
paths: ['vscode-forge/**']
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g. 0.2.0). Leave empty to use package.json version.'
required: false
type: string
dry_run:
description: 'Dry run — package but do not publish'
required: false
type: boolean
default: false
permissions:
contents: write
defaults:
run:
shell: bash
working-directory: vscode-forge
jobs:
# -------------------------------------------------------------------
# Job: validate
# Compiles TypeScript, packages the .vsix, and uploads as artifact.
# Runs on every push/PR that touches vscode-forge/.
# -------------------------------------------------------------------
validate:
name: Validate & Package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: vscode-forge/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint (type-check)
run: npm run lint
- name: Compile
run: npm run compile
- name: Package extension
run: npx @vscode/vsce package --no-dependencies
- name: List packaged contents
run: npx @vscode/vsce ls --no-dependencies
- name: Upload .vsix artifact
uses: actions/upload-artifact@v4
with:
name: forge-devtools-vsix
path: vscode-forge/*.vsix
retention-days: 30
# -------------------------------------------------------------------
# Job: publish
# Publishes to VS Code Marketplace and Open VSX Registry.
# Runs only on version tags or manual dispatch (when not dry_run).
# -------------------------------------------------------------------
publish:
name: Publish Extension
runs-on: ubuntu-latest
needs: validate
if: >-
(startsWith(github.ref, 'refs/tags/vscode-forge/v'))
|| (github.event_name == 'workflow_dispatch' && inputs.dry_run != true)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: vscode-forge/package-lock.json
- name: Install dependencies
run: npm ci
- name: Resolve version
id: version
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
npm version "$VERSION" --no-git-tag-version
else
VERSION=$(node -p "require('./package.json').version")
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if [[ "$VERSION" == *"-"* ]]; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi
echo "::notice::Publishing forge-devtools v$VERSION"
- name: Package extension
run: npx @vscode/vsce package --no-dependencies
- name: Publish to VS Code Marketplace
run: npx @vscode/vsce publish --no-dependencies
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish to Open VSX Registry
if: env.OVSX_PAT != ''
run: npx ovsx publish *.vsix
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: vscode-forge/v${{ steps.version.outputs.version }}
name: Forge DevTools v${{ steps.version.outputs.version }}
body: |
## Forge DevTools v${{ steps.version.outputs.version }}
### Install
- **VS Code Marketplace**: Search for "Forge DevTools" in the Extensions panel
- **Manual**: Download the `.vsix` file below and install via `code --install-extension forge-devtools-${{ steps.version.outputs.version }}.vsix`
files: vscode-forge/*.vsix
prerelease: ${{ steps.version.outputs.is_prerelease == 'true' }}
generate_release_notes: true