Skip to content

Commit 9f6fec0

Browse files
committed
chore: format publish changelog
1 parent d28a41e commit 9f6fec0

1 file changed

Lines changed: 31 additions & 188 deletions

File tree

.github/workflows/runner-publish.yaml

Lines changed: 31 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
description: "Skip publish into marketplaces step"
1111
default: false
1212
type: boolean
13+
skipPackageJsonMatch:
14+
description: "Skip tag validation with package.json version (testing)"
15+
default: false
16+
type: boolean
1317

1418
permissions:
1519
contents: write
@@ -19,11 +23,22 @@ jobs:
1923
runs-on: ubuntu-latest
2024

2125
steps:
26+
- name: 🔖 Show input tag
27+
run: echo "Publishing version ${{ github.event.inputs.tag }}"
28+
2229
- name: 👷🏻 Checkout Repository
2330
uses: actions/checkout@v4
2431
with:
2532
fetch-depth: 0
2633

34+
- name: ✅ Verify Git tag exists
35+
run: |
36+
git fetch --tags
37+
if ! git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then
38+
echo "❌ Tag '${{ github.event.inputs.tag }}' does not exist!"
39+
exit 1
40+
fi
41+
2742
- name: ✅ Validate and extract tag
2843
run: |
2944
TAG=${{ github.event.inputs.tag }}
@@ -34,6 +49,19 @@ jobs:
3449
echo "TAG=$TAG" >> $GITHUB_ENV
3550
echo "VERSION=${TAG#runner-v}" >> $GITHUB_ENV
3651
52+
- name: ✅ Ensure tag matches package.json version
53+
if: ${{ github.event.inputs.skipPackageJsonMatch != 'true' }}
54+
working-directory: packages/extester-runner
55+
run: |
56+
PKG_VERSION=$(node -p "require('./package.json').version")
57+
TAG_VERSION=${VERSION}
58+
echo "Package version: $PKG_VERSION"
59+
echo "Input tag version: $TAG_VERSION"
60+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
61+
echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)!"
62+
exit 1
63+
fi
64+
3765
- name: ⚙️ Set up Node.js
3866
uses: actions/setup-node@v4
3967
with:
@@ -94,6 +122,8 @@ jobs:
94122
}
95123
96124
{
125+
echo "## What's Changed"
126+
format_section 'break|breaking' "⚠️ Breaking"
97127
format_section 'feat|feature' "🚀 Features"
98128
format_section 'fix' "🚫 Bugs"
99129
format_section 'test' "🔎 Tests"
@@ -136,193 +166,6 @@ jobs:
136166
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137167
run: |
138168
gh release create "$TAG" \
139-
--title "ExTester Runner v${VERSION}" \
169+
--title "ExTester Runner - Preview (v${VERSION})" \
140170
--notes-file CHANGELOG.md \
141171
extester-runner-${VERSION}.vsix
142-
143-
# name: 🚀 Publish ExTester Runner
144-
145-
# on:
146-
# workflow_dispatch:
147-
# inputs:
148-
# tag:
149-
# description: "Version tag to publish (runner-vX.X.X)"
150-
# required: true
151-
# skipPublish:
152-
# description: "Skip publish into marketplaces step"
153-
# default: false
154-
# type: boolean
155-
156-
# permissions:
157-
# contents: write
158-
159-
# jobs:
160-
# build-and-publish:
161-
# runs-on: ubuntu-latest
162-
163-
# steps:
164-
# - name: 🔖 Show input tag
165-
# run: echo "Publishing version ${{ github.event.inputs.tag }}"
166-
167-
# - name: ✅ Validate tag format
168-
# run: |
169-
# TAG=${{ github.event.inputs.tag }}
170-
# if [[ ! "$TAG" =~ ^runner-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
171-
# echo "❌ Invalid tag format: $TAG. Use format like 'runner-v1.2.3'"
172-
# exit 1
173-
# fi
174-
175-
# - name: 👷🏻 Checkout Repository
176-
# uses: actions/checkout@v4
177-
178-
# - name: ✅ Verify Git tag exists
179-
# run: |
180-
# git fetch --tags
181-
# if ! git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then
182-
# echo "❌ Tag '${{ github.event.inputs.tag }}' does not exist!"
183-
# exit 1
184-
# fi
185-
186-
# # - name: ✅ Ensure tag matches package.json version
187-
# # working-directory: packages/extester-runner
188-
# # run: |
189-
# # PKG_VERSION=$(node -p "require('./package.json').version")
190-
# # TAG=${{ github.event.inputs.tag }}
191-
# # TAG_VERSION=${TAG#runner-v}
192-
# # echo "Package version: $PKG_VERSION"
193-
# # echo "Input tag version: $TAG_VERSION"
194-
# # if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
195-
# # echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)!"
196-
# # exit 1
197-
# # fi
198-
199-
# - name: 👷🏻 Checkout the tag
200-
# uses: actions/checkout@v4
201-
# with:
202-
# ref: ${{ github.event.inputs.tag }}
203-
# fetch-depth: 0 # Important! Fetch full history
204-
205-
# - name: ⚙️ Setup NodeJS
206-
# uses: actions/setup-node@v4
207-
# with:
208-
# node-version: 20
209-
210-
# - name: 📦 Install vsce
211-
# run: npm install -g @vscode/vsce
212-
213-
# - name: 📦 Install ovsx
214-
# run: npm install -g ovsx
215-
216-
# - name: 📦 Install GitHub CLI
217-
# run: sudo apt-get install gh -y
218-
219-
# - name: 🔧 Install
220-
# run: npm ci
221-
222-
# - name: 🔧 Build
223-
# run: npm run build
224-
225-
# - name: 🛠 Extract version from a tag
226-
# id: version
227-
# run: |
228-
# TAG=${{ github.event.inputs.tag }}
229-
# VER=$(echo "$TAG" | sed 's/^runner-v//')
230-
# echo "VERSION=$VER" >> $GITHUB_OUTPUT
231-
232-
# - name: 🛠 Package extension
233-
# working-directory: packages/extester-runner
234-
# run: vsce package -o extester-runner-${{ steps.version.outputs.VERSION }}.vsix
235-
236-
# - name: 🧾 Inspect packaged contents
237-
# working-directory: packages/extester-runner
238-
# run: vsce ls extester-runner-${{ steps.version.outputs.VERSION }}.vsix
239-
240-
# - name: 🚀 Publish to VS Code Marketplace
241-
# if: ${{ github.event.inputs.skipPublish != 'true' }}
242-
# working-directory: packages/extester-runner
243-
# run: vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath extester-runner-${{ steps.version.outputs.VERSION }}.vsix
244-
245-
# - name: 🚀 Publish to Open VSX Registry
246-
# if: ${{ github.event.inputs.skipPublish != 'true' }}
247-
# working-directory: packages/extester-runner
248-
# run: ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} extester-runner-${{ steps.version.outputs.VERSION }}.vsix
249-
250-
# - name: 📣 Add summary
251-
# if: ${{ github.event.inputs.skipPublish != 'true' }}
252-
# run: |
253-
# echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to VS Code Marketplace" >> $GITHUB_STEP_SUMMARY
254-
# echo "#### ✅ Published \`extester-runner-${{ steps.version.outputs.VERSION }}.vsix\` to Open VSX Registry" >> $GITHUB_STEP_SUMMARY
255-
256-
# - name: 💾 Upload VSIX
257-
# uses: actions/upload-artifact@v4
258-
# with:
259-
# name: extester-runner-${{ steps.version.outputs.VERSION }}.vsix
260-
# path: "packages/extester-runner/extester-runner-${{ steps.version.outputs.VERSION }}.vsix"
261-
262-
# - name: 📝 Generate changelog
263-
# id: changelog
264-
# working-directory: packages/extester-runner
265-
# run: |
266-
# TAG=${{ github.event.inputs.tag }}
267-
# VERSION=${TAG#runner-v}
268-
# PREV_TAG=$(git tag --list "runner-v*" --sort=-creatordate | grep -v "$TAG" | head -n 1)
269-
270-
# echo "Comparing changes from $PREV_TAG to $TAG in packages/extester-runner"
271-
272-
# git fetch --unshallow || true
273-
274-
# if [ -z "$PREV_TAG" ]; then
275-
# # First tag: include everything reachable from it
276-
# LOG=$(git log "$TAG" --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
277-
# if [ -z "$LOG" ]; then
278-
# # Still empty? Fallback to full history
279-
# LOG=$(git log --reverse -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
280-
# fi
281-
# else
282-
# LOG=$(git log "$PREV_TAG..$TAG" -- packages/extester-runner --no-merges --pretty=format:'%s (%h)')
283-
# fi
284-
285-
# if [ -z "$LOG" ]; then
286-
# LOG="Initial release (first tag)"
287-
# fi
288-
289-
# # Helper to format sections
290-
# format_section() {
291-
# local pattern="$1"
292-
# local title="$2"
293-
# local content=$(echo "$LOG" | grep -iE "$pattern" || true)
294-
# if [[ -n "$content" ]]; then
295-
# echo "### $title"
296-
# echo "$content"
297-
# echo ""
298-
# fi
299-
# }
300-
301-
# {
302-
# format_section 'feat|feature' "🚀 Features"
303-
# format_section 'fix' "🚫 Bugs"
304-
# format_section 'test' "🔎 Tests"
305-
# format_section 'chore|refactor|internal|ci|docs' "🔧 Maintenance"
306-
# format_section 'deps|dependencies' "📦 Dependencies"
307-
308-
# # Other commits not matching any above
309-
# OTHER=$(echo "$LOG" | grep -vE 'feat|feature|fix|test|chore|refactor|internal|ci|docs|deps|dependencies' || true)
310-
# if [[ -n "$OTHER" ]]; then
311-
# echo "### 🧼 Other Changes"
312-
# echo "$OTHER"
313-
# echo ""
314-
# fi
315-
# } > CHANGELOG.md
316-
317-
# echo "Generated CHANGELOG.md:"
318-
# cat CHANGELOG.md
319-
320-
# - name: 🚀 Publish GitHub Release with VSIX
321-
# env:
322-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
323-
# working-directory: packages/extester-runner
324-
# run: |
325-
# TAG=${{ github.event.inputs.tag }}
326-
# gh release create "$TAG" --title "ExTester Runner v${{ steps.version.outputs.VERSION }}" \
327-
# --notes-file CHANGELOG.md \
328-
# "extester-runner-${{ steps.version.outputs.VERSION }}.vsix"

0 commit comments

Comments
 (0)