Skip to content

ci: Release correction (#42) #50

ci: Release correction (#42)

ci: Release correction (#42) #50

Workflow file for this run

name: CI
on:
pull_request:
branches: [master]
push:
branches: [master]
jobs:
test:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm build
- run: pnpm test
release:
if: 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@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- run: pnpm install --frozen-lockfile
- run: pnpm build
- 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}
- 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:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
- name: Extract changelog for release
run: |
VERSION=$(git describe --tags --abbrev=0)
awk "/^## $VERSION/{flag=1;next}/^## /{flag=0}flag" CHANGELOG.md > release-notes.md
shell: bash
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
body_path: release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}