diff --git a/.github/workflows/publication.yml b/.github/workflows/publication.yml new file mode 100644 index 00000000..f6e6a4b5 --- /dev/null +++ b/.github/workflows/publication.yml @@ -0,0 +1,49 @@ +name: Publication πŸ“¦ + +on: + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + ref: ${{ github.event.release.tag_name }} + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Verify tag matches package.json + run: | + TAG_NAME="${{ github.event.release.tag_name }}" + TAG_VERSION="${TAG_NAME#v}" + PKG_VERSION=$(jq -r .version package.json) + + 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:lib + + - name: Publish to npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc + + bun publish + echo "npm 배포가 μ™„λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€."