Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# .github/workflows/publish.yml
name: Publish Package to npm on Tag

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # vX.Y.Z 형식의 태그가 푸시될 때 실행

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read # 코드를 읽기만 하면 됨
id-token: write # npm 인증을 위해 필요할 수 있음
steps:
- name: Checkout code
uses: actions/checkout@v4
# 자동으로 트리거된 태그의 코드를 가져옴

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20" # 사용할 Node.js 버전
registry-url: "https://registry.npmjs.org/"

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- name: Build package
run: pnpm run build

- name: Package preview (dry-run)
run: pnpm run pack:preview

- name: Publish package to npm
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GRANULAR_TOKEN }}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
"analyze:bundle": "echo 'Bundle Analysis:' && du -h dist/bundle/* && echo '\\nGzipped sizes:' && gzip -c dist/bundle/kr-corekit.js | wc -c | awk '{print \"ESM: \" $1/1024 \" KB\"}' && gzip -c dist/bundle/kr-corekit.cjs | wc -c | awk '{print \"CJS: \" $1/1024 \" KB\"}'",
"pack:preview": "npm pack --dry-run",
"test": "vitest",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"release:patch": "pnpm version patch && git push origin main --follow-tags",
"release:minor": "pnpm version minor && git push origin main --follow-tags",
"release:major": "pnpm version major && git push origin main --follow-tags"
},
"repository": {
"type": "git",
Expand Down