Skip to content

Commit 8e872e2

Browse files
committed
feat: migrate VS Code extension CI/CD from Azure DevOps to GitHub Actions
- Add vscode-ci.yml: Multi-channel build (preview/stable), cross-platform testing (macOS, Windows PS5.1/7.x, Ubuntu), preview auto-publish on main - Add codeql.yml: CodeQL security scanning for TypeScript/JavaScript - Update release-vscode.yml: Use InvokeBuild for stable releases - Update package.json: Change repo URLs to Azure/PSDocs.Azure - Delete .azure-pipelines/: Remove Azure DevOps pipeline (fully migrated) - Update MONOREPO_MIGRATION.md: Remove post-merge steps (subtrees added), document new workflows
1 parent d6fa2fd commit 8e872e2

11 files changed

Lines changed: 274 additions & 380 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# CodeQL Security Analysis
2+
# Scans VS Code extension for security vulnerabilities
3+
4+
name: CodeQL
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- 'packages/vscode-extension/**/*.ts'
11+
- 'packages/vscode-extension/**/*.js'
12+
pull_request:
13+
branches: [main]
14+
paths:
15+
- 'packages/vscode-extension/**/*.ts'
16+
- 'packages/vscode-extension/**/*.js'
17+
schedule:
18+
# Run weekly on Monday at 00:00 UTC
19+
- cron: '0 0 * * 1'
20+
21+
jobs:
22+
analyze:
23+
name: Analyze
24+
runs-on: ubuntu-latest
25+
permissions:
26+
actions: read
27+
contents: read
28+
security-events: write
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v3
36+
with:
37+
languages: javascript-typescript
38+
# Focus on VS Code extension source
39+
paths:
40+
- packages/vscode-extension/src
41+
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: '20.x'
46+
cache: 'npm'
47+
cache-dependency-path: packages/vscode-extension/package-lock.json
48+
49+
- name: Install dependencies
50+
working-directory: packages/vscode-extension
51+
run: npm ci
52+
53+
- name: Build
54+
working-directory: packages/vscode-extension
55+
run: npm run compile
56+
57+
- name: Perform CodeQL Analysis
58+
uses: github/codeql-action/analyze@v3
59+
with:
60+
category: "/language:javascript-typescript"
Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,77 @@
1+
# Release VS Code Extension (Stable)
2+
# Triggered by vscode-v* tags for stable releases
3+
14
name: Release VS Code Extension
25

36
on:
47
push:
58
tags:
69
- 'vscode-v*'
710

11+
permissions:
12+
contents: write
13+
814
jobs:
915
release:
16+
name: Release Stable
1017
runs-on: ubuntu-latest
1118
environment: release
19+
1220
steps:
13-
- uses: actions/checkout@v4
14-
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
1524
- name: Setup Node.js
1625
uses: actions/setup-node@v4
1726
with:
1827
node-version: '20.x'
19-
28+
cache: 'npm'
29+
cache-dependency-path: packages/vscode-extension/package-lock.json
30+
31+
- name: Setup PowerShell modules
32+
shell: pwsh
33+
run: |
34+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
35+
Install-Module -Name InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force
36+
2037
- name: Extract version from tag
2138
id: version
2239
run: |
2340
VERSION=${GITHUB_REF#refs/tags/vscode-v}
2441
echo "version=$VERSION" >> $GITHUB_OUTPUT
25-
42+
echo "Releasing version: $VERSION"
43+
2644
- name: Install dependencies
2745
working-directory: packages/vscode-extension
2846
run: npm ci
29-
30-
- name: Update version in package.json
31-
working-directory: packages/vscode-extension
32-
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version
33-
34-
- name: Build and Package
47+
48+
- name: Build stable channel
49+
shell: pwsh
3550
working-directory: packages/vscode-extension
36-
run: npx @vscode/vsce package --out psdocs-vscode-${{ steps.version.outputs.version }}.vsix
37-
51+
run: |
52+
Invoke-Build Build -Channel 'stable' -Build '${{ steps.version.outputs.version }}'
53+
54+
- name: Find VSIX file
55+
id: vsix
56+
working-directory: packages/vscode-extension/out/package
57+
run: |
58+
VSIX_FILE=$(ls *.vsix 2>/dev/null | head -1)
59+
echo "file=$VSIX_FILE" >> $GITHUB_OUTPUT
60+
echo "path=packages/vscode-extension/out/package/$VSIX_FILE" >> $GITHUB_OUTPUT
61+
echo "Found VSIX: $VSIX_FILE"
62+
3863
- name: Publish to VS Marketplace
39-
working-directory: packages/vscode-extension
64+
working-directory: packages/vscode-extension/out/package
4065
env:
4166
VSCE_PAT: ${{ secrets.VSCE_PAT }}
42-
run: npx @vscode/vsce publish -p $VSCE_PAT
43-
67+
run: |
68+
npx @vscode/vsce publish --packagePath "${{ steps.vsix.outputs.file }}" --pat "$VSCE_PAT"
69+
4470
- name: Create GitHub Release
4571
uses: softprops/action-gh-release@v2
4672
with:
4773
name: VS Code Extension v${{ steps.version.outputs.version }}
4874
body_path: packages/vscode-extension/CHANGELOG.md
4975
generate_release_notes: true
5076
files: |
51-
packages/vscode-extension/psdocs-vscode-${{ steps.version.outputs.version }}.vsix
77+
${{ steps.vsix.outputs.path }}

.github/workflows/vscode-ci.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# VS Code Extension CI
2+
# Migrated from Azure DevOps pipeline
3+
4+
name: VS Code Extension CI
5+
6+
on:
7+
pull_request:
8+
branches: [main]
9+
paths:
10+
- 'packages/vscode-extension/**'
11+
- '.github/workflows/vscode-ci.yml'
12+
push:
13+
branches: [main]
14+
paths:
15+
- 'packages/vscode-extension/**'
16+
- '.github/workflows/vscode-ci.yml'
17+
18+
env:
19+
NODE_VERSION: '20.x'
20+
21+
jobs:
22+
# Build extension for multiple channels
23+
build:
24+
name: Build (${{ matrix.channel }})
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
channel: [preview, stable]
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ env.NODE_VERSION }}
38+
cache: 'npm'
39+
cache-dependency-path: packages/vscode-extension/package-lock.json
40+
41+
- name: Setup PowerShell modules
42+
shell: pwsh
43+
run: |
44+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
45+
Install-Module -Name InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force
46+
47+
- name: Install dependencies
48+
working-directory: packages/vscode-extension
49+
run: npm ci
50+
51+
- name: Build extension
52+
shell: pwsh
53+
working-directory: packages/vscode-extension
54+
run: |
55+
Invoke-Build Build -Channel '${{ matrix.channel }}'
56+
57+
- name: Upload artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: extension-${{ matrix.channel }}
61+
path: packages/vscode-extension/out/package/
62+
retention-days: 7
63+
64+
# Cross-platform testing
65+
test:
66+
name: Test (${{ matrix.os }}, PowerShell ${{ matrix.pwsh && '7.x' || '5.1' }})
67+
needs: build
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os: [ubuntu-latest, macos-latest, windows-latest]
73+
pwsh: [true]
74+
include:
75+
# Add PowerShell 5.1 test on Windows
76+
- os: windows-latest
77+
pwsh: false
78+
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
83+
- name: Setup Node.js
84+
uses: actions/setup-node@v4
85+
with:
86+
node-version: ${{ env.NODE_VERSION }}
87+
cache: 'npm'
88+
cache-dependency-path: packages/vscode-extension/package-lock.json
89+
90+
- name: Download extension artifact
91+
uses: actions/download-artifact@v4
92+
with:
93+
name: extension-preview
94+
path: packages/vscode-extension/out/package
95+
96+
- name: Start Xvfb (Linux)
97+
if: runner.os == 'Linux'
98+
run: |
99+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
100+
echo "Started Xvfb"
101+
102+
- name: Install dependencies
103+
working-directory: packages/vscode-extension
104+
run: npm ci
105+
106+
- name: Run tests (PowerShell 7.x)
107+
if: matrix.pwsh == true
108+
shell: pwsh
109+
working-directory: packages/vscode-extension
110+
run: |
111+
# Run extension tests
112+
npm test
113+
env:
114+
DISPLAY: ':99.0'
115+
116+
- name: Run tests (PowerShell 5.1)
117+
if: matrix.pwsh == false
118+
shell: powershell
119+
working-directory: packages/vscode-extension
120+
run: |
121+
# Run extension tests
122+
npm test
123+
env:
124+
DISPLAY: ':99.0'
125+
126+
# Auto-publish preview on main merge
127+
publish-preview:
128+
name: Publish Preview
129+
needs: [build, test]
130+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
131+
runs-on: ubuntu-latest
132+
environment: release
133+
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v4
137+
138+
- name: Setup Node.js
139+
uses: actions/setup-node@v4
140+
with:
141+
node-version: ${{ env.NODE_VERSION }}
142+
143+
- name: Download preview artifact
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: extension-preview
147+
path: packages/vscode-extension/out/package
148+
149+
- name: Install vsce
150+
run: npm install -g @vscode/vsce
151+
152+
- name: Find VSIX file
153+
id: vsix
154+
working-directory: packages/vscode-extension/out/package
155+
run: |
156+
VSIX_FILE=$(ls *.vsix 2>/dev/null | head -1)
157+
echo "file=$VSIX_FILE" >> $GITHUB_OUTPUT
158+
echo "Found VSIX: $VSIX_FILE"
159+
160+
- name: Publish to VS Marketplace (Pre-release)
161+
working-directory: packages/vscode-extension/out/package
162+
env:
163+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
164+
run: |
165+
vsce publish --pre-release --packagePath "${{ steps.vsix.outputs.file }}" --pat "$VSCE_PAT"

MONOREPO_MIGRATION.md

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,18 @@ packages/
1818
docs/
1919
├── psdocs/ # PSDocs engine docs (to be added via git subtree)
2020
├── psdocs-azure/ # PSDocs.Azure docs (existing content)
21-
└── vscode/ # VS Code extension docs (to be added via git subtree)
21+
└── vscode/ # VS Code extension docs
2222
2323
build/
2424
└── common.ps1 # Shared build utilities
2525
2626
.github/workflows/
2727
├── ci.yml # Main CI workflow with path-based filtering
28+
├── vscode-ci.yml # VS Code extension CI (build, test, preview publish)
29+
├── codeql.yml # CodeQL security scanning
2830
├── release-psdocs.yml # Release workflow for PSDocs engine
2931
├── release-psdocs-azure.yml # Release workflow for PSDocs.Azure
30-
└── release-vscode.yml # Release workflow for VS Code extension
31-
```
32-
33-
## Post-Merge Steps
34-
35-
After this PR is merged, the following git subtree commands need to be run locally to add the other repositories with their full history:
36-
37-
### 1. Clone the repository
38-
39-
```bash
40-
git clone https://github.com/Azure/PSDocs.Azure.git
41-
cd PSDocs.Azure
42-
```
43-
44-
### 2. Add PSDocs engine
45-
46-
```bash
47-
git subtree add --prefix=packages/psdocs https://github.com/microsoft/PSDocs.git main --squash -m "feat: add PSDocs engine from microsoft/PSDocs"
48-
```
49-
50-
### 3. Add VS Code extension
51-
52-
```bash
53-
git subtree add --prefix=packages/vscode-extension https://github.com/microsoft/PSDocs-vscode.git main --squash -m "feat: add VS Code extension from microsoft/PSDocs-vscode"
54-
```
55-
56-
### 4. Push changes
57-
58-
```bash
59-
git push origin main
32+
└── release-vscode.yml # Release workflow for VS Code extension (stable)
6033
```
6134

6235
## Building the Monorepo

0 commit comments

Comments
 (0)