Skip to content

fix(release): Set releaseTagPattern to match existing v{version} git … #119

fix(release): Set releaseTagPattern to match existing v{version} git …

fix(release): Set releaseTagPattern to match existing v{version} git … #119

Workflow file for this run

name: CI
on:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:
inputs:
reason:
description: 'Reason for manual trigger'
required: false
default: 'Manual release'
jobs:
validation:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6
with:
filter: tree:0
fetch-depth: 0
- uses: pnpm/action-setup@v6
- run: pnpm install --frozen-lockfile
env:
HUSKY: 0
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm build
# Coverage summary chain (continue-on-error, always publish/upload/enforce)
- name: Generate coverage summary
id: coverage
run: pnpm coverage:summary
continue-on-error: true
- name: Publish coverage summary to Checks UI
if: steps.coverage.outcome == 'success' || steps.coverage.outcome == 'failure'
run: |
{
echo "# Coverage check"
echo
if [ "${{ steps.coverage.outcome }}" = "success" ]; then
echo "Result: passed"
else
echo "Result: failed"
fi
echo
cat .coverage-reports/summary.md
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report artifacts
if: steps.coverage.outcome == 'success' || steps.coverage.outcome == 'failure'
uses: actions/upload-artifact@v7
with:
name: coverage-summary
path: .coverage-reports
- name: Post coverage summary as PR comment
if: steps.coverage.outcome == 'success' || steps.coverage.outcome == 'failure'
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const outcome = '${{ steps.coverage.outcome }}';
const status = outcome === 'success' ? '✅ passed' : '❌ failed';
let body = `## Coverage check\n\nResult: ${status}\n`;
try {
body += '\n' + fs.readFileSync('.coverage-reports/summary.md', 'utf8');
} catch {
body += '\n_(Coverage report not available.)_';
}
const marker = '<!-- coverage-summary -->';
body = marker + '\n' + body;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
- name: Enforce coverage summary status
if: steps.coverage.outcome == 'failure'
run: exit 1
release:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release)'))
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
filter: tree:0
fetch-depth: 0
- uses: pnpm/action-setup@v6
name: Install pnpm
with:
version: 10.33.0
run_install: false
- name: Setup git creds
env:
config_email: ${{ secrets.GIT_CONFIG_EMAIL }}
config_un: ${{ secrets.GIT_CONFIG_USERNAME }}
run: |
git config --local user.email ${config_email}
git config --local user.name ${config_un}
- run: pnpm install --frozen-lockfile
env:
HUSKY: 0
- uses: nrwl/nx-set-shas@v5
- run: pnpm build
- name: Set up .npmrc for publishing
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: pnpm exec nx release --yes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true