This commit is contained in:
병준 박 2025-04-26 02:11:57 +00:00
parent 0aa6626fca
commit f621d183c0

View File

@ -68,7 +68,7 @@ spec:
# 필수 패키지 설치 및 Git 설정 # 필수 패키지 설치 및 Git 설정
apk add --no-cache git apk add --no-cache git
git config --global --add safe.directory '*' git config --global --add safe.directory '*'
git config --global init.defaultBranch main # 모든 새 저장소 기본 브랜치 설정 git config --global init.defaultBranch main
TARGETS="$(params.targetProjects)" TARGETS="$(params.targetProjects)"
SOURCES="$(params.sourceProjects)" SOURCES="$(params.sourceProjects)"
@ -77,34 +77,34 @@ spec:
for TARGET in "$@"; do for TARGET in "$@"; do
SRC=$(echo "$SOURCES" | cut -d' ' -f1) SRC=$(echo "$SOURCES" | cut -d' ' -f1)
SOURCES=$(echo "$SOURCES" | cut -s -d' ' -f2-) SOURCES=$(echo "$SOURCES" | cut -s -d' ' -f2-)
TARGET_PATH="/workspace/base/$(params.context)/source/$(params.workspaceName)/${TARGET}"
# 소스 디렉터리 Git 초기화 (main 브랜치) # 소스 디렉터리 Git 초기화
cd "$SRC" cd "$SRC"
if [ ! -d .git ]; then if [ ! -d .git ]; then
git init -b main # 명시적 main 브랜치 생성 git init -b main
git add . git add .
git commit -m "init" git commit -m "init"
fi fi
cd - cd -
# Nx 비대화형 임포트 실행 # Nx 비대화형 임포트 실행 (옵션 수정)
echo "Importing: $SRC → $TARGET_PATH" echo "Importing: $SRC → $TARGET"
npx nx import "$SRC" "$TARGET" \ npx nx import "$SRC" "$TARGET" \
--no-interactive \ --interactive=false \ # ✅ 올바른 옵션
--branch=main \ --ref=main \ # ✅ --branch → --ref
--sourceDirectory=. --sourceDirectory=.
# 버전 업데이트 # 버전 업데이트
sed -i.bak "s/^version = .*/version = \"$(params.version)\"/" "$TARGET_PATH/Cargo.toml" sed -i.bak "s/^version = .*/version = \"$(params.version)\"/" "$TARGET/Cargo.toml"
rm -f "$TARGET_PATH/Cargo.toml.bak" rm -f "$TARGET/Cargo.toml.bak"
# 변경사항 커밋 (실패 시 무시) # 변경사항 커밋
git add . git add .
git commit -m "chore: import $TARGET (v$(params.version))" || true git commit -m "chore: import $TARGET (v$(params.version))" || true
done done
- name: git-commit - name: git-commit
image: alpine/git:latest image: alpine/git:latest
workingDir: /workspace/base/$(params.context)/source workingDir: /workspace/base/$(params.context)/source