Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- develop-hw
- develop2
- develop
workflow_dispatch:

jobs:
build-and-deploy:
Expand All @@ -20,6 +21,7 @@ jobs:
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
Expand All @@ -30,6 +32,37 @@ jobs:
NODE_OPTIONS: '--max-old-space-size=4096'
TOOL_NODE_FLAGS: '--max-old-space-size=4096'
run: pnpm prod
# dev 채널: develop push 마다 새 prerelease 를 dev 태그로 배포한다.
# 버전은 러너에서만 바꾸고 커밋하지 않으므로, publish 후 package.json 을 원복해
# 뒤따르는 build.sh/deploy.sh 가 dist 브랜치에 담는 내용물은 기존과 동일하게 유지한다.
- name: publish dev
if: github.ref == 'refs/heads/develop'
shell: bash
run: |
set -euo pipefail
NEXT=$(node -p "const v = require('./package.json').version.split('-')[0].split('.').map(Number); v[2] += 1; v.join('.')")
# github.run_number 는 이 워크플로 전체의 누적 실행 횟수라 dev 채널 도입 시점에 이미 313 이었다.
# dev 번호를 1 부터 시작시키려고 도입 직전 실행 번호를 기준점으로 뺀다.
# master/develop2/deploy 브랜치 push 도 같은 카운터를 올리므로 번호는 건너뛸 수 있지만,
# 재publish 가 거부되지 않도록 단조증가하기만 하면 되므로 연속성은 필요하지 않다.
DEV_SEQ=$(( ${{ github.run_number }} - 313 ))
(( DEV_SEQ >= 1 )) || { echo "::error::dev 번호가 1 미만입니다 (run_number=${{ github.run_number }}, 기준점=313)"; exit 1; }
VERSION="$NEXT-dev.$DEV_SEQ"
# 버전 계산이 조용히 실패한 채 publish 되는 것을 막는다.
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-dev\.[0-9]+$ ]] || { echo "::error::계산된 버전이 올바르지 않습니다: $VERSION"; exit 1; }
echo "publish @entrylabs/entry@$VERSION (dist-tag: dev)"
npm pkg set version="$VERSION"
npm publish --tag dev
git checkout -- package.json
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# latest 채널: master push 시, package.json 버전이 npm 에 아직 없을 때만 배포된다.
# 이미 있는 버전이면 액션이 조용히 skip 하므로 master push 마다 돌려도 안전하다.
- name: publish latest
if: github.ref == 'refs/heads/master'
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Define branch name
id: target_branch
shell: bash
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/release.yml

This file was deleted.

Loading