Skip to content
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Npm Publish

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2

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

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Verify tag matches package.json
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
TAG_VERSION="${TAG_NAME#v}"
PKG_VERSION=$(node -p "require('./package.json').version")

if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "Error: 태그 버전과 package.json 버전이 일치하지 않습니다."
echo "tag version: ${TAG_VERSION}"
echo "package.json version: ${PKG_VERSION}"
exit 1
fi
echo "✅ 버전 일치 확인: ${TAG_VERSION}"

- name: Build package
run: |
bun run prepare
bun run build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

최근 작업한 내역에서 app 빌드와 lib 빌드과 나누어져 명령어가 bun run build:lib 로 변경되었습니다.

참고 PR입니다.
#685

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

64c964c에서 반영되었습니다!


- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "${NODE_AUTH_TOKEN}" ]; then
echo "Error: NPM_TOKEN이 설정되지 않았습니다."
exit 1
fi

TAG_NAME="${{ github.event.release.tag_name }}"
VERSION=${TAG_NAME#v}
echo "버전 ${VERSION} 배포를 시작합니다..."

npm publish --access public
echo "npm 배포가 완료되었습니다."