Skip to content

Commit

Permalink
chore(ci): add release and publish to npm ci action
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfscream committed Nov 8, 2023
1 parent 8e5eef6 commit 3f63428
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/release_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release and Publish

on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.17'
registry-url: 'https://registry.npmjs.org'

- name: use pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"dev": "turbo run dev",
"build": "turbo run build",
"test": "turbo run test",
"format": "prettier --write ."
"format": "prettier --write .",
"release": "turbo run test build && changeset version && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
Expand Down

0 comments on commit 3f63428

Please sign in to comment.