Skip to content

Fix: 배포 문제 해결중 #1

Fix: 배포 문제 해결중

Fix: 배포 문제 해결중 #1

Workflow file for this run

name: Node.js Package
on:
release:
types: [created]
push:
branches: [ main ]
tags: [ 'v*' ]
workflow_dispatch: # 수동으로 워크플로우 실행 가능
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test
- run: npm run build
publish-npm:
needs: build
runs-on: ubuntu-latest
# 태그 푸시나 릴리스 생성 또는 수동 트리거에서만 배포
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: 'npm'
# 의존성 설치 및 빌드
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
# 배포 전 버전 확인 및 로그
- name: Version check
run: |
echo "Deploying version $(npm pkg get version | tr -d '\"')"
npm pkg get version | tr -d '\"' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || (echo "Invalid version format" && exit 1)
# NPM에 배포
- name: Publish to npm
run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}