Skip to content

chore(release): v3.7.0 #219

chore(release): v3.7.0

chore(release): v3.7.0 #219

name: 'Release VSCode Extension'
on:
push:
tags:
- 'v*'
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
if: ${{ !startsWith(github.ref, 'refs/tags/v') || !contains(github.ref_name, '-') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
version: 10.34.5
run_install: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
ver="${GITHUB_REF_NAME#v}"
else
desc=$(git describe --tags --long --match "v*" 2>/dev/null || echo "v0.0.1-0-g0000000")
ver=$(echo "$desc" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+)-g.*/\1-post.\2/')
fi
echo "Setting version to ${ver}"
pnpm run version -- "${ver}"
- name: Build webview
run: pnpm build:vscode
- name: Install extension dependencies
working-directory: src-vscode
run: npm ci
- name: Build extension
working-directory: src-vscode
run: |
npm run compile
- name: Package extension
working-directory: src-vscode
run: |
npm exec -- vsce package
mkdir -p vsix
mv *.vsix vsix/
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: maa-log-analyzer-extension
path: 'src-vscode/vsix'
release:
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-')
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: assets
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: 'npm'
cache-dependency-path: src-vscode/package-lock.json
- name: Install extension toolchain
working-directory: src-vscode
run: npm ci
- name: Publish
working-directory: src-vscode
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
run: npm exec -- vsce publish --packagePath ../assets/maa-log-analyzer-extension/*.vsix
- name: Extract release notes
run: |
node scripts/changelog-notes.mjs "$GITHUB_REF_NAME" > "${RUNNER_TEMP}/release-notes.md"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
echo "Release $GITHUB_REF_NAME already exists, skipping."
exit 0
fi
notes="${RUNNER_TEMP}/release-notes.md"
gh release create "$GITHUB_REF_NAME" \
assets/maa-log-analyzer-extension/*.vsix \
--title "$GITHUB_REF_NAME" \
--notes-file "$notes"