add github action to automate versioning and publishing #1
This file contains 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
# Adapted from shadcn/ui | |
name: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use PNPM | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9.0.6 | |
- name: Use node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Create publish PR or publish directly | |
id: changesets | |
uses: changesets/action@v1.4.1 | |
with: | |
commit: "chore(release): version release" | |
title: "chore(release): version release" | |
version: node .github/scripts/changeset-version.js | |
publish: npx changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_ENV: production |