ci: re-enable GitHub releases with @jscutlery/semver #78
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: PR Release Preview | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, edited] | |
| jobs: | |
| release-preview: | |
| name: Release preview | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup | |
| - name: Validate PR title | |
| id: commitlint | |
| run: | | |
| if echo "${{ github.event.pull_request.title }}" | npx --no-install commitlint > commitlint.err 2>&1; then | |
| echo "ok=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ok=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Generate release preview comment | |
| id: preview | |
| if: always() | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| BASE_REF: ${{ github.base_ref }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| COMMITLINT_OK: ${{ steps.commitlint.outputs.ok == 'true' && '1' || '0' }} | |
| run: npx ts-node --transpile-only -O '{"module":"commonjs"}' tools/ci/pr-release-preview.ts | |
| - name: Upload release preview comment | |
| if: always() && steps.preview.outcome != 'skipped' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-preview-comment | |
| path: comment.md | |
| retention-days: 1 | |
| - name: Enforce valid PR title | |
| if: steps.commitlint.outputs.ok != 'true' | |
| run: | | |
| echo "::error::PR title must follow Conventional Commits (see commitlint output in the PR comment)." | |
| exit 1 | |
| - name: Enforce release preview succeeded | |
| if: steps.preview.outcome == 'failure' | |
| run: exit 1 |