-
-
Notifications
You must be signed in to change notification settings - Fork 1
301 lines (262 loc) · 12.1 KB
/
release.yml
File metadata and controls
301 lines (262 loc) · 12.1 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: 🚀 Release Pipeline
on:
# Manual release creation (the sacred manual tag!)
push:
tags:
- "v*"
branches:
- "release/**"
- main
paths-ignore:
- "**.md"
- "docs/**"
- ".github/**"
# Manual workflow dispatch for emergency releases
workflow_dispatch:
inputs:
release_type:
description: "Release type"
required: true
default: "prerelease"
type: choice
options:
- prerelease
- release
- hotfix
permissions:
contents: write # Required for creating releases and uploading assets
packages: read # Required for downloading artifacts
jobs:
# 🔍 Determine release strategy
determine-release:
runs-on: ubuntu-latest
outputs:
is_tag: ${{ startsWith(github.ref, 'refs/tags/') }}
is_main: ${{ github.ref == 'refs/heads/main' }}
is_release_branch: ${{ startsWith(github.ref, 'refs/heads/release/') }}
version: ${{ steps.version.outputs.version }}
release_type: ${{ steps.type.outputs.type }}
should_publish_marketplace: ${{ steps.publish.outputs.marketplace }}
should_create_github_release: ${{ steps.publish.outputs.github }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🏷️ Extract version and determine release type
id: version
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/v(.*)$ ]]; then
VERSION="${BASH_REMATCH[1]}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" =~ ^refs/heads/release/v(.*)$ ]]; then
VERSION="${BASH_REMATCH[1]}-rc.${{ github.run_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
PACKAGE_VERSION=$(node -p "require('./package.json').version")
VERSION="$PACKAGE_VERSION-dev.${{ github.run_number }}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
- name: 🎯 Determine release type
id: type
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/v.*$ ]]; then
echo "type=release" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "type=stable" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" =~ ^refs/heads/release/.*$ ]]; then
echo "type=prerelease" >> $GITHUB_OUTPUT
else
echo "type=development" >> $GITHUB_OUTPUT
fi
- name: 📦 Determine publication targets
id: publish
run: |
# Only publish to marketplace on manual tags or main branch
if [[ "${{ steps.type.outputs.type }}" == "release" ]] || [[ "${{ steps.type.outputs.type }}" == "stable" ]]; then
echo "marketplace=true" >> $GITHUB_OUTPUT
else
echo "marketplace=false" >> $GITHUB_OUTPUT
fi
# Create GitHub releases for tags and pre-releases
if [[ "${{ steps.type.outputs.type }}" == "release" ]] || [[ "${{ steps.type.outputs.type }}" == "prerelease" ]]; then
echo "github=true" >> $GITHUB_OUTPUT
else
echo "github=false" >> $GITHUB_OUTPUT
fi
# 🏗️ Build VSIX with dynamic versioning
build-vsix:
needs: determine-release
runs-on: ubuntu-latest
outputs:
vsix-name: ${{ steps.build.outputs.vsix-name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: 📦 Install dependencies
run: npm ci
- name: 🔢 Update version in package.json
run: |
npm version ${{ needs.determine-release.outputs.version }} --no-git-tag-version
echo "Updated version to: $(node -p "require('./package.json').version")"
- name: 🧪 Run tests (fast check)
run: |
echo "ℹ️ Skipping full test suite in release build for speed"
echo "✅ Full tests already run in CI pipeline"
npm run lint
npm run check-types
- name: 🏗️ Build VSIX
id: build
run: |
npm run package-vsix
VSIX_FILE=$(ls *.vsix | head -1)
echo "vsix-name=$VSIX_FILE" >> $GITHUB_OUTPUT
echo "Built: $VSIX_FILE"
# Add release type suffix to filename for identification
if [[ "${{ needs.determine-release.outputs.release_type }}" != "release" ]]; then
NEW_NAME="${VSIX_FILE%.vsix}-${{ needs.determine-release.outputs.release_type }}.vsix"
mv "$VSIX_FILE" "$NEW_NAME"
echo "vsix-name=$NEW_NAME" >> $GITHUB_OUTPUT
echo "Renamed to: $NEW_NAME"
fi
- name: 📤 Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: excel-power-query-editor-vsix-${{ needs.determine-release.outputs.release_type }}
path: "*.vsix"
retention-days: 90
# 🎉 Create GitHub Release
github-release:
needs: [determine-release, build-vsix]
runs-on: ubuntu-latest
if: needs.determine-release.outputs.should_create_github_release == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📥 Download VSIX
uses: actions/download-artifact@v4
with:
name: excel-power-query-editor-vsix-${{ needs.determine-release.outputs.release_type }}
- name: 📝 Generate changelog
id: changelog
run: |
if [[ "${{ needs.determine-release.outputs.is_tag }}" == "true" ]]; then
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
if [[ -n "$PREV_TAG" ]]; then
CHANGELOG=$(git log --pretty=format:"- %s" $PREV_TAG..HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s" -10)
fi
else
CHANGELOG=$(git log --pretty=format:"- %s" -5)
fi
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: 🚀 Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.determine-release.outputs.is_tag == 'true' && github.ref_name || format('v{0}', needs.determine-release.outputs.version) }}
name: ${{ needs.determine-release.outputs.release_type == 'release' && format('Excel Power Query Editor v{0}', needs.determine-release.outputs.version) || format('Excel Power Query Editor v{0} ({1})', needs.determine-release.outputs.version, needs.determine-release.outputs.release_type) }}
body: |
## 🎉 Excel Power Query Editor ${{ needs.determine-release.outputs.version }}
**Release Type:** ${{ needs.determine-release.outputs.release_type }}
**Build:** ${{ github.run_number }}
**Commit:** ${{ github.sha }}
### 📝 Changes:
${{ steps.changelog.outputs.changelog }}
### 📦 Installation:
**Option 1: Download and Install**
1. Download the `.vsix` file below
2. Install via VS Code: `code --install-extension excel-power-query-editor-*.vsix`
**Option 2: Command Line**
```bash
# Download latest pre-release
curl -L -o excel-power-query-editor.vsix "https://github.com/ewc3labs/excel-power-query-editor/releases/latest/download/excel-power-query-editor-${{ needs.determine-release.outputs.version }}-${{ needs.determine-release.outputs.release_type }}.vsix"
# Install
code --install-extension excel-power-query-editor.vsix
```
### 🧪 Testing Status:
✅ All 71 tests passing across Node 22/24 on Ubuntu/Windows/macOS
### 🔄 What's Next?
- ⭐ **Feedback?** [Create an issue](https://github.com/ewc3labs/excel-power-query-editor/issues/new)
- 📚 **Documentation:** [User Guide](https://github.com/ewc3labs/excel-power-query-editor#readme)
- 🚀 **Stable Release:** Coming soon to VS Code Marketplace
---
**Need help?** Check out our [documentation](https://github.com/ewc3labs/excel-power-query-editor#readme) or [report issues](https://github.com/ewc3labs/excel-power-query-editor/issues).
artifacts: "*.vsix"
prerelease: ${{ needs.determine-release.outputs.release_type != 'release' }}
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
# 🌐 Publish to VS Code Marketplace
marketplace-publish:
needs: [determine-release, build-vsix]
runs-on: ubuntu-latest
if: needs.determine-release.outputs.should_publish_marketplace == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: 📥 Download VSIX
uses: actions/download-artifact@v4
with:
name: excel-power-query-editor-vsix-${{ needs.determine-release.outputs.release_type }}
- name: 🚀 Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
if [[ -z "$VSCE_PAT" ]]; then
echo "⚠️ VSCE_PAT secret not configured - skipping marketplace publishing"
echo "To enable automatic publishing:"
echo "1. Get Personal Access Token from https://marketplace.visualstudio.com/manage"
echo "2. Add as repository secret named VSCE_PAT"
echo "3. Re-run this workflow"
exit 0
fi
echo "🚀 Publishing to VS Code Marketplace..."
npm install -g @vscode/vsce
vsce publish --pat $VSCE_PAT
echo "✅ Successfully published to VS Code Marketplace!"
# 📊 Release Summary
summary:
needs: [determine-release, build-vsix, github-release, marketplace-publish]
runs-on: ubuntu-latest
if: always()
steps:
- name: 📋 Release Summary
run: |
echo "## 🎉 Release Pipeline Complete!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.determine-release.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Type:** ${{ needs.determine-release.outputs.release_type }}" >> $GITHUB_STEP_SUMMARY
echo "**VSIX:** ${{ needs.build-vsix.outputs.vsix-name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.github-release.result }}" == "success" ]]; then
echo "✅ **GitHub Release:** Created successfully" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ needs.determine-release.outputs.should_create_github_release }}" == "true" ]]; then
echo "❌ **GitHub Release:** Failed" >> $GITHUB_STEP_SUMMARY
else
echo "⏭️ **GitHub Release:** Skipped (not a release build)" >> $GITHUB_STEP_SUMMARY
fi
if [[ "${{ needs.marketplace-publish.result }}" == "success" ]]; then
echo "✅ **Marketplace:** Published successfully" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ needs.determine-release.outputs.should_publish_marketplace }}" == "true" ]]; then
echo "❌ **Marketplace:** Failed" >> $GITHUB_STEP_SUMMARY
else
echo "⏭️ **Marketplace:** Skipped (development build)" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🎯 Next Steps:" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.determine-release.outputs.release_type }}" == "prerelease" ]]; then
echo "- Test this pre-release thoroughly" >> $GITHUB_STEP_SUMMARY
echo "- When ready, create a manual tag: \`git tag v${{ needs.determine-release.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- Push the tag to trigger full release: \`git push origin v${{ needs.determine-release.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
elif [[ "${{ needs.determine-release.outputs.release_type }}" == "development" ]]; then
echo "- Continue development on your feature branch" >> $GITHUB_STEP_SUMMARY
echo "- Merge to \`release/v0.5.0\` when ready for pre-release testing" >> $GITHUB_STEP_SUMMARY
fi