Skip to content

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

chore: configure Conventional Commits, Husky, and Changesets

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

Workflow file for this run

name: Preview & Publish create-db
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
push:
branches: [main]
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:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Disable Husky in CI
run: echo "HUSKY=0" >> $GITHUB_ENV
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Bump preview version in create-db
working-directory: ./create-db
run: |
# e.g. 0.0.1 β†’ 0.0.1-pr3-my-branch
npm version prerelease \
--preid pr${{ github.event.number }}-${{ github.event.pull_request.head.ref }} \
--no-git-tag-version
- 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 }}
# no git checks so we can publish a prerelease off a PR
publish:
name: πŸš€ Bump & publish real release
if: github.event_name == 'push'
needs: preview
runs-on: ubuntu-latest
steps:
- name: Checkout code (full history & tags)
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
- name: Disable Husky in CI
run: echo "HUSKY=0" >> $GITHUB_ENV
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Bump versions & generate changelogs
run: pnpm version
- name: Push version bump commit & tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push origin main --follow-tags
- name: Dry-run npm publish
run: pnpm --filter create-db publish --dry-run
- name: Publish create-db to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.CREATE_DB_TOKEN_NPM }}
run: pnpm --filter create-db publish --access public