Skip to content

[CI/CD] test

[CI/CD] test #23

Workflow file for this run

name: Node.js CI/CD
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org/"
- name: Install dependencies (Yarn Berry)
run: yarn install --immutable
- name: Run tests (if test script exists)
run: yarn workspaces foreach --all --topological --parallel --no-private run test
continue-on-error: true # 테스트 스크립트가 없어도 계속 진행
- name: Build project (if build script exists)
run: yarn workspaces foreach --all --topological --parallel --no-private run build
continue-on-error: true # 빌드 스크립트가 없어도 계속 진행
- name: Bump version & create tag (only on main branch)
if: github.ref == 'refs/heads/main'
run: |
yarn workspaces foreach --all version patch
git push --follow-tags
- name: Set up .npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Debug .npmrc
run: cat ~/.npmrc
- name: Check NPM Authentication
run: npm whoami
# - name: Publish to npm using yarn workspaces
# if: github.ref == 'refs/heads/main'
# run: yarn workspaces foreach --verbose --all --topological --no-private npm publish --access public
# env:
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm (only on main branch)
if: github.ref == 'refs/heads/main'
run: cd ./packages/main && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}