chore: configure Conventional Commits, Husky, and Changesets #5
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: Preview & Publish create-db | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize] | |
jobs: | |
preview: | |
name: 🚧 Preview release (PR #${{ github.event.number }} – ${{ github.event.pull_request.head.ref }}) | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
# 1️⃣ check out all history so that `npm version` can run | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# 2️⃣ turn off Husky so our CI scripts don’t block | |
- name: Disable Husky in CI | |
run: echo "HUSKY=0" >> $GITHUB_ENV | |
# 3️⃣ install pnpm | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
# 4️⃣ install deps | |
- name: Install dependencies | |
run: pnpm install | |
# 5️⃣ bump just the preview version in the create-db package | |
- name: Bump preview version in create-db | |
working-directory: ./create-db | |
run: | | |
npm version prerelease \ | |
--preid pr${{ github.event.number }}-${{ github.event.pull_request.head.ref }} \ | |
--no-git-tag-version | |
# 6️⃣ disable pnpm's git-clean safeguard permanently for this runner | |
- name: Disable pnpm git-checks | |
run: pnpm config set git-checks false | |
# 7️⃣ publish under the `pr<PR_NUMBER>` dist-tag | |
- name: Publish preview to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.CREATE_DB_TOKEN_NPM }} | |
run: | | |
pnpm --filter create-db publish \ | |
--access public \ | |
--tag pr${{ github.event.number }} |