Skip to content

[CI/CD] token

[CI/CD] token #31

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'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies (Yarn Berry)
run: yarn install --immutable
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Debug .npmrc
run: cat .npmrc
continue-on-error: true # 빌드 스크립트가 없어도 계속 진행
- name: Debug .yarnrc.yml
run: cat .yarnrc.yml
continue-on-error: true # 빌드 스크립트가 없어도 계속 진행
- 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: 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:
# NODE_AUTH_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
# - name: Configure Yarn authentication
# run: |
# echo 'npmRegistryServer: "https://registry.npmjs.org"' >> .yarnrc.yml
# echo 'npmAlwaysAuth: true' >> .yarnrc.yml
# echo 'npmAuthToken: "${{ secrets.NPM_TOKEN }}"' >> .yarnrc.yml