🚀 Publish ExTester Runner #27
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🚀 Publish ExTester Runner | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Version tag to publish (runner-vX.X.X)" | |
| required: true | |
| skipPublish: | |
| description: "Skip publish into marketplaces step" | |
| default: false | |
| type: boolean | |
| skipPackageJsonMatch: | |
| description: "Skip tag validation with package.json version (testing)" | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🔖 Show input tag | |
| run: echo "Publishing version ${{ github.event.inputs.tag }}" | |
| - name: 👷🏻 Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: ✅ Verify Git tag exists | |
| run: | | |
| git fetch --tags | |
| if ! git rev-parse "refs/tags/${{ github.event.inputs.tag }}" >/dev/null 2>&1; then | |
| echo "❌ Tag '${{ github.event.inputs.tag }}' does not exist!" | |
| exit 1 | |
| fi | |
| - name: ✅ Validate and extract tag | |
| run: | | |
| TAG=${{ github.event.inputs.tag }} | |
| if [[ ! "$TAG" =~ ^runner-v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "❌ Invalid tag format: $TAG. Use format like 'runner-v1.2.3'" | |
| exit 1 | |
| fi | |
| echo "TAG=$TAG" >> $GITHUB_ENV | |
| echo "VERSION=${TAG#runner-v}" >> $GITHUB_ENV | |
| - name: ✅ Ensure tag matches package.json version | |
| if: ${{ github.event.inputs.skipPackageJsonMatch != 'true' }} | |
| working-directory: packages/extester-runner | |
| run: | | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| TAG_VERSION=${VERSION} | |
| echo "Package version: $PKG_VERSION" | |
| echo "Input tag version: $TAG_VERSION" | |
| if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then | |
| echo "❌ Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)!" | |
| exit 1 | |
| fi | |
| - name: ⚙️ Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: 📦 Install tools | |
| run: | | |
| npm install -g @vscode/vsce ovsx | |
| sudo apt-get install -y gh | |
| - name: 🔧 Install deps and build | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: 🛠 Package extension | |
| working-directory: packages/extester-runner | |
| run: | | |
| vsce package -o extester-runner-${VERSION}.vsix | |
| vsce ls extester-runner-${VERSION}.vsix | |
| - name: 📝 Generate changelog | |
| working-directory: packages/extester-runner | |
| run: | | |
| PREV_TAG=$(git tag --list "runner-v*" --sort=-creatordate | grep -v "$TAG" | head -n 1) | |
| echo "Comparing changes from $PREV_TAG to $TAG" | |
| if [ -z "$PREV_TAG" ]; then | |
| LOG=$(git log "$TAG" --reverse --oneline -- .) | |
| [ -z "$LOG" ] && LOG=$(git log --reverse --oneline -- .) | |
| else | |
| LOG=$(git log "$PREV_TAG..$TAG" --oneline -- .) | |
| fi | |
| if [ -z "$LOG" ]; then | |
| LOG="Initial release (first tag)" | |
| fi | |
| format_section() { | |
| local pattern="($1)\(runner\)" | |
| local title="$2" | |
| local content=$(echo "$LOG" | grep -iE "$pattern" || true) | |
| if [[ -n "$content" ]]; then | |
| echo "### $title" | |
| echo "$content" | |
| echo | |
| fi | |
| } | |
| format_other_section() { | |
| local title="🧼 Other Changes" | |
| local content=$(echo "$LOG" | grep -vE "(feat|feature|fix|test|chore|refactor|internal|ci|docs|deps|dependencies)\(runner\)" || true) | |
| if [[ -n "$content" ]]; then | |
| echo "### $title" | |
| echo "$content" | |
| echo | |
| fi | |
| } | |
| { | |
| echo "## What's Changed" | |
| format_section 'break|breaking' "⚠️ Breaking" | |
| format_section 'feat|feature' "🚀 Features" | |
| format_section 'fix' "🚫 Bugs" | |
| format_section 'test' "🔎 Tests" | |
| format_section 'chore|refactor|internal|ci|docs' "🔧 Maintenance" | |
| format_section 'deps|dependencies' "📦 Dependencies" | |
| format_other_section | |
| } > CHANGELOG.md | |
| echo "Generated CHANGELOG.md" | |
| cat CHANGELOG.md | |
| - name: 🚀 Publish to VS Code Marketplace | |
| if: ${{ github.event.inputs.skipPublish != 'true' }} | |
| working-directory: packages/extester-runner | |
| run: | | |
| vsce publish --pat ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} \ | |
| --packagePath extester-runner-${VERSION}.vsix | |
| - name: 🚀 Publish to Open VSX Registry | |
| if: ${{ github.event.inputs.skipPublish != 'true' }} | |
| working-directory: packages/extester-runner | |
| run: | | |
| ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} extester-runner-${VERSION}.vsix | |
| - name: 📣 Add summary | |
| if: ${{ github.event.inputs.skipPublish != 'true' }} | |
| run: | | |
| echo "#### ✅ Published \`extester-runner-${VERSION}.vsix\` to VS Code Marketplace" >> $GITHUB_STEP_SUMMARY | |
| echo "#### ✅ Published \`extester-runner-${VERSION}.vsix\` to Open VSX Registry" >> $GITHUB_STEP_SUMMARY | |
| - name: 💾 Upload VSIX | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extester-runner-${{ env.VERSION }}.vsix | |
| path: packages/extester-runner/extester-runner-${{ env.VERSION }}.vsix | |
| - name: 🚀 Publish GitHub Release | |
| working-directory: packages/extester-runner | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "$TAG" \ | |
| --title "ExTester Runner - Preview (v${VERSION})" \ | |
| --notes-file CHANGELOG.md \ | |
| extester-runner-${VERSION}.vsix |