Skip to content

Commit 4a2a259

Browse files
committed
rework publish flow
1 parent 5d01bd1 commit 4a2a259

1 file changed

Lines changed: 234 additions & 103 deletions

File tree

.github/workflows/runner-publish.yaml

Lines changed: 234 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -19,140 +19,67 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- name: 🔖 Show input tag
23-
run: echo "Publishing version ${{ github.event.inputs.tag }}"
22+
- name: 👷🏻 Checkout Repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
2426

25-
- name: ✅ Validate tag format
27+
- name: ✅ Validate and extract tag
2628
run: |
2729
TAG=${{ github.event.inputs.tag }}
2830
if [[ ! "$TAG" =~ ^runner-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
2931
echo "❌ Invalid tag format: $TAG. Use format like 'runner-v1.2.3'"
3032
exit 1
3133
fi
34+
echo "TAG=$TAG" >> $GITHUB_ENV
35+
echo "VERSION=${TAG#runner-v}" >> $GITHUB_ENV
3236
33-
- name: 👷🏻 Checkout Repository
34-
uses: actions/checkout@v4
35-
36-
- name: ✅ Verify Git tag exists
37-
run: |
38-
git fetch --tags
39-
if ! git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then
40-
echo "❌ Tag '${{ github.event.inputs.tag }}' does not exist!"
41-
exit 1
42-
fi
43-
44-
# - name: ✅ Ensure tag matches package.json version
45-
# working-directory: packages/extester-runner
46-
# run: |
47-
# PKG_VERSION=$(node -p "require('./package.json').version")
48-
# TAG=${{ github.event.inputs.tag }}
49-
# TAG_VERSION=${TAG#runner-v}
50-
# echo "Package version: $PKG_VERSION"
51-
# echo "Input tag version: $TAG_VERSION"
52-
# if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
53-
# echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)!"
54-
# exit 1
55-
# fi
56-
57-
- name: 👷🏻 Checkout the tag
58-
uses: actions/checkout@v4
59-
with:
60-
ref: ${{ github.event.inputs.tag }}
61-
fetch-depth: 0 # Important! Fetch full history
62-
63-
- name: ⚙️ Setup NodeJS
37+
- name: ⚙️ Set up Node.js
6438
uses: actions/setup-node@v4
6539
with:
6640
node-version: 20
6741

68-
- name: 📦 Install vsce
69-
run: npm install -g @vscode/vsce
70-
71-
- name: 📦 Install ovsx
72-
run: npm install -g ovsx
73-
74-
- name: 📦 Install GitHub CLI
75-
run: sudo apt-get install gh -y
76-
77-
- name: 🔧 Install
78-
run: npm ci
79-
80-
- name: 🔧 Build
81-
run: npm run build
42+
- name: 📦 Install tools
43+
run: |
44+
npm install -g @vscode/vsce ovsx
45+
sudo apt-get install -y gh
8246
83-
- name: 🛠 Extract version from a tag
84-
id: version
47+
- name: 🔧 Install deps and build
8548
run: |
86-
TAG=${{ github.event.inputs.tag }}
87-
VER=$(echo "$TAG" | sed 's/^runner-v//')
88-
echo "VERSION=$VER" >> $GITHUB_OUTPUT
49+
npm ci
50+
npm run build
8951
9052
- name: 🛠 Package extension
9153
working-directory: packages/extester-runner
92-
run: vsce package -o extester-runner-${{ steps.version.outputs.VERSION }}.vsix
93-
94-
- name: 🧾 Inspect packaged contents
95-
working-directory: packages/extester-runner
96-
run: vsce ls extester-runner-${{ steps.version.outputs.VERSION }}.vsix
97-
98-
- name: 🚀 Publish to VS Code Marketplace
99-
if: ${{ github.event.inputs.skipPublish != 'true' }}
100-
working-directory: packages/extester-runner
101-
run: vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath extester-runner-${{ steps.version.outputs.VERSION }}.vsix
102-
103-
- name: 🚀 Publish to Open VSX Registry
104-
if: ${{ github.event.inputs.skipPublish != 'true' }}
105-
working-directory: packages/extester-runner
106-
run: ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} extester-runner-${{ steps.version.outputs.VERSION }}.vsix
107-
108-
- name: 📣 Add summary
109-
if: ${{ github.event.inputs.skipPublish != 'true' }}
11054
run: |
111-
echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to VS Code Marketplace" >> $GITHUB_STEP_SUMMARY
112-
echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to Open VSX Registry" >> $GITHUB_STEP_SUMMARY
113-
114-
- name: 💾 Upload VSIX
115-
uses: actions/upload-artifact@v4
116-
with:
117-
name: extester-runner-${{ steps.version.outputs.VERSION }}.vsix
118-
path: "packages/extester-runner/extester-runner-${{ steps.version.outputs.VERSION }}.vsix"
55+
vsce package -o extester-runner-${VERSION}.vsix
56+
vsce ls extester-runner-${VERSION}.vsix
11957
12058
- name: 📝 Generate changelog
121-
id: changelog
12259
working-directory: packages/extester-runner
12360
run: |
124-
TAG=${{ github.event.inputs.tag }}
125-
VERSION=${TAG#runner-v}
12661
PREV_TAG=$(git tag --list "runner-v*" --sort=-creatordate | grep -v "$TAG" | head -n 1)
127-
128-
echo "Comparing changes from $PREV_TAG to $TAG in packages/extester-runner"
129-
130-
git fetch --unshallow || true
62+
echo "Comparing changes from $PREV_TAG to $TAG"
13163
13264
if [ -z "$PREV_TAG" ]; then
133-
# First tag: include everything reachable from it
134-
LOG=$(git log "$TAG" --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
135-
if [ -z "$LOG" ]; then
136-
# Still empty? Fallback to full history
137-
LOG=$(git log --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
138-
fi
65+
LOG=$(git log "$TAG" --reverse -- . --no-merges --pretty=format:'%s (%h)')
66+
[ -z "$LOG" ] && LOG=$(git log --reverse -- . --no-merges --pretty=format:'%s (%h)')
13967
else
140-
LOG=$(git log "$PREV_TAG..$TAG" -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
68+
LOG=$(git log "$PREV_TAG..$TAG" -- . --no-merges --pretty=format:'%s (%h)')
14169
fi
14270
14371
if [ -z "$LOG" ]; then
14472
LOG="Initial release (first tag)"
14573
fi
14674
147-
# Helper to format sections
14875
format_section() {
14976
local pattern="$1"
15077
local title="$2"
15178
local content=$(echo "$LOG" | grep -iE "$pattern" || true)
15279
if [[ -n "$content" ]]; then
15380
echo "### $title"
15481
echo "$content"
155-
echo ""
82+
echo
15683
fi
15784
}
15885
@@ -162,8 +89,6 @@ jobs:
16289
format_section 'test' "🔎 Tests"
16390
format_section 'chore|refactor|internal|ci|docs' "🔧 Maintenance"
16491
format_section 'deps|dependencies' "📦 Dependencies"
165-
166-
# Other commits not matching any above
16792
OTHER=$(echo "$LOG" | grep -vE 'feat|feature|fix|test|chore|refactor|internal|ci|docs|deps|dependencies' || true)
16893
if [[ -n "$OTHER" ]]; then
16994
echo "### 🧼 Other Changes"
@@ -172,15 +97,221 @@ jobs:
17297
fi
17398
} > CHANGELOG.md
17499
175-
echo "Generated CHANGELOG.md:"
100+
echo "Generated CHANGELOG.md"
176101
cat CHANGELOG.md
177102
178-
- name: 🚀 Publish GitHub Release with VSIX
103+
- name: 🚀 Publish to VS Code Marketplace
104+
if: ${{ github.event.inputs.skipPublish != 'true' }}
105+
working-directory: packages/extester-runner
106+
run: |
107+
vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} \
108+
--packagePath extester-runner-${VERSION}.vsix
109+
110+
- name: 🚀 Publish to Open VSX Registry
111+
if: ${{ github.event.inputs.skipPublish != 'true' }}
112+
working-directory: packages/extester-runner
113+
run: |
114+
ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} extester-runner-${VERSION}.vsix
115+
116+
- name: 💾 Upload VSIX
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: extester-runner-${{ env.VERSION }}.vsix
120+
path: packages/extester-runner/extester-runner-${{ env.VERSION }}.vsix
121+
122+
- name: 🚀 Publish GitHub Release
123+
working-directory: packages/extester-runner
179124
env:
180125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181-
working-directory: packages/extester-runner
182126
run: |
183-
TAG=${{ github.event.inputs.tag }}
184-
gh release create "$TAG" --title "ExTester Runner v${{ steps.version.outputs.VERSION }}" \
127+
gh release create "$TAG" \
128+
--title "ExTester Runner v${VERSION}" \
185129
--notes-file CHANGELOG.md \
186-
"extester-runner-${{ steps.version.outputs.VERSION }}.vsix"
130+
extester-runner-${VERSION}.vsix
131+
132+
# name: 🚀 Publish ExTester Runner
133+
134+
# on:
135+
# workflow_dispatch:
136+
# inputs:
137+
# tag:
138+
# description: "Version tag to publish (runner-vX.X.X)"
139+
# required: true
140+
# skipPublish:
141+
# description: "Skip publish into marketplaces step"
142+
# default: false
143+
# type: boolean
144+
145+
# permissions:
146+
# contents: write
147+
148+
# jobs:
149+
# build-and-publish:
150+
# runs-on: ubuntu-latest
151+
152+
# steps:
153+
# - name: 🔖 Show input tag
154+
# run: echo "Publishing version ${{ github.event.inputs.tag }}"
155+
156+
# - name: ✅ Validate tag format
157+
# run: |
158+
# TAG=${{ github.event.inputs.tag }}
159+
# if [[ ! "$TAG" =~ ^runner-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
160+
# echo "❌ Invalid tag format: $TAG. Use format like 'runner-v1.2.3'"
161+
# exit 1
162+
# fi
163+
164+
# - name: 👷🏻 Checkout Repository
165+
# uses: actions/checkout@v4
166+
167+
# - name: ✅ Verify Git tag exists
168+
# run: |
169+
# git fetch --tags
170+
# if ! git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then
171+
# echo "❌ Tag '${{ github.event.inputs.tag }}' does not exist!"
172+
# exit 1
173+
# fi
174+
175+
# # - name: ✅ Ensure tag matches package.json version
176+
# # working-directory: packages/extester-runner
177+
# # run: |
178+
# # PKG_VERSION=$(node -p "require('./package.json').version")
179+
# # TAG=${{ github.event.inputs.tag }}
180+
# # TAG_VERSION=${TAG#runner-v}
181+
# # echo "Package version: $PKG_VERSION"
182+
# # echo "Input tag version: $TAG_VERSION"
183+
# # if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
184+
# # echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)!"
185+
# # exit 1
186+
# # fi
187+
188+
# - name: 👷🏻 Checkout the tag
189+
# uses: actions/checkout@v4
190+
# with:
191+
# ref: ${{ github.event.inputs.tag }}
192+
# fetch-depth: 0 # Important! Fetch full history
193+
194+
# - name: ⚙️ Setup NodeJS
195+
# uses: actions/setup-node@v4
196+
# with:
197+
# node-version: 20
198+
199+
# - name: 📦 Install vsce
200+
# run: npm install -g @vscode/vsce
201+
202+
# - name: 📦 Install ovsx
203+
# run: npm install -g ovsx
204+
205+
# - name: 📦 Install GitHub CLI
206+
# run: sudo apt-get install gh -y
207+
208+
# - name: 🔧 Install
209+
# run: npm ci
210+
211+
# - name: 🔧 Build
212+
# run: npm run build
213+
214+
# - name: 🛠 Extract version from a tag
215+
# id: version
216+
# run: |
217+
# TAG=${{ github.event.inputs.tag }}
218+
# VER=$(echo "$TAG" | sed 's/^runner-v//')
219+
# echo "VERSION=$VER" >> $GITHUB_OUTPUT
220+
221+
# - name: 🛠 Package extension
222+
# working-directory: packages/extester-runner
223+
# run: vsce package -o extester-runner-${{ steps.version.outputs.VERSION }}.vsix
224+
225+
# - name: 🧾 Inspect packaged contents
226+
# working-directory: packages/extester-runner
227+
# run: vsce ls extester-runner-${{ steps.version.outputs.VERSION }}.vsix
228+
229+
# - name: 🚀 Publish to VS Code Marketplace
230+
# if: ${{ github.event.inputs.skipPublish != 'true' }}
231+
# working-directory: packages/extester-runner
232+
# run: vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath extester-runner-${{ steps.version.outputs.VERSION }}.vsix
233+
234+
# - name: 🚀 Publish to Open VSX Registry
235+
# if: ${{ github.event.inputs.skipPublish != 'true' }}
236+
# working-directory: packages/extester-runner
237+
# run: ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} extester-runner-${{ steps.version.outputs.VERSION }}.vsix
238+
239+
# - name: 📣 Add summary
240+
# if: ${{ github.event.inputs.skipPublish != 'true' }}
241+
# run: |
242+
# echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to VS Code Marketplace" >> $GITHUB_STEP_SUMMARY
243+
# echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to Open VSX Registry" >> $GITHUB_STEP_SUMMARY
244+
245+
# - name: 💾 Upload VSIX
246+
# uses: actions/upload-artifact@v4
247+
# with:
248+
# name: extester-runner-${{ steps.version.outputs.VERSION }}.vsix
249+
# path: "packages/extester-runner/extester-runner-${{ steps.version.outputs.VERSION }}.vsix"
250+
251+
# - name: 📝 Generate changelog
252+
# id: changelog
253+
# working-directory: packages/extester-runner
254+
# run: |
255+
# TAG=${{ github.event.inputs.tag }}
256+
# VERSION=${TAG#runner-v}
257+
# PREV_TAG=$(git tag --list "runner-v*" --sort=-creatordate | grep -v "$TAG" | head -n 1)
258+
259+
# echo "Comparing changes from $PREV_TAG to $TAG in packages/extester-runner"
260+
261+
# git fetch --unshallow || true
262+
263+
# if [ -z "$PREV_TAG" ]; then
264+
# # First tag: include everything reachable from it
265+
# LOG=$(git log "$TAG" --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
266+
# if [ -z "$LOG" ]; then
267+
# # Still empty? Fallback to full history
268+
# LOG=$(git log --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
269+
# fi
270+
# else
271+
# LOG=$(git log "$PREV_TAG..$TAG" -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
272+
# fi
273+
274+
# if [ -z "$LOG" ]; then
275+
# LOG="Initial release (first tag)"
276+
# fi
277+
278+
# # Helper to format sections
279+
# format_section() {
280+
# local pattern="$1"
281+
# local title="$2"
282+
# local content=$(echo "$LOG" | grep -iE "$pattern" || true)
283+
# if [[ -n "$content" ]]; then
284+
# echo "### $title"
285+
# echo "$content"
286+
# echo ""
287+
# fi
288+
# }
289+
290+
# {
291+
# format_section 'feat|feature' "🚀 Features"
292+
# format_section 'fix' "🚫 Bugs"
293+
# format_section 'test' "🔎 Tests"
294+
# format_section 'chore|refactor|internal|ci|docs' "🔧 Maintenance"
295+
# format_section 'deps|dependencies' "📦 Dependencies"
296+
297+
# # Other commits not matching any above
298+
# OTHER=$(echo "$LOG" | grep -vE 'feat|feature|fix|test|chore|refactor|internal|ci|docs|deps|dependencies' || true)
299+
# if [[ -n "$OTHER" ]]; then
300+
# echo "### 🧼 Other Changes"
301+
# echo "$OTHER"
302+
# echo ""
303+
# fi
304+
# } > CHANGELOG.md
305+
306+
# echo "Generated CHANGELOG.md:"
307+
# cat CHANGELOG.md
308+
309+
# - name: 🚀 Publish GitHub Release with VSIX
310+
# env:
311+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
312+
# working-directory: packages/extester-runner
313+
# run: |
314+
# TAG=${{ github.event.inputs.tag }}
315+
# gh release create "$TAG" --title "ExTester Runner v${{ steps.version.outputs.VERSION }}" \
316+
# --notes-file CHANGELOG.md \
317+
# "extester-runner-${{ steps.version.outputs.VERSION }}.vsix"

0 commit comments

Comments
 (0)