Repository navigation
108 lines (85 loc) · 2.77 KB
/
Copy pathpublish.yml
File metadata and controls
108 lines (85 loc) · 2.77 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
name: Publish to Marketplace
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v1.6.0, v1.6.1, etc.
workflow_dispatch: # Allow manual triggering from GitHub UI
permissions:
contents: write
jobs:
# Run tests before publishing
test:
name: Run Tests
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.x
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Compile TypeScript
run: pnpm run compile
- name: Run unit tests
run: pnpm run test:unit
# Build and publish to VS Code Marketplace
publish:
name: Publish Extension
runs-on: ubuntu-latest
needs: test # Only publish if tests pass
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Compile TypeScript
run: pnpm run compile
- name: Package extension
run: pnpm run package
- name: Publish to VS Code Marketplace
run: |
pnpm add -g @vscode/vsce
vsce publish --packagePath $(ls *.vsix) --no-dependencies
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: '*.vsix'
body: |
## VS Code Extension Release ${{ steps.get_version.outputs.VERSION }}
🚀 Published to [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=jsonify.noted)
### Installation
- Install directly from VS Code Extensions tab
- Or download the `.vsix` file below and install manually
### Changes
See [CHANGELOG.md](https://github.com/jsonify/noted/blob/main/CHANGELOG.md) for details.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: noted-v${{ steps.get_version.outputs.VERSION }}.vsix
path: '*.vsix'
retention-days: 90