Skip to content

chore: configure Conventional Commits, Husky, and Changesets #7

chore: configure Conventional Commits, Husky, and Changesets

chore: configure Conventional Commits, Husky, and Changesets #7

Workflow file for this run

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 full history so `npm version` can run
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# 2️⃣ turn off Husky in CI
- 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 dependencies
- name: Install dependencies
run: pnpm install
# 5️⃣ bump just the preview version in create-db
- 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
- name: Disable pnpm git-checks
run: pnpm config set git-checks false
# 7️⃣ configure npm auth so publish can log in
- name: Configure npm auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.CREATE_DB_TOKEN_NPM }}" > ~/.npmrc
# 8️⃣ publish only the create-db package under tag pr<N>
- name: Publish preview to npm
working-directory: ./create-db
run: pnpm publish --access public --tag pr${{ github.event.number }}