init
This commit is contained in:
parent
3f2a536903
commit
0aa6626fca
@ -65,11 +65,10 @@ spec:
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Git 설치
|
# 필수 패키지 설치 및 Git 설정
|
||||||
apk add --no-cache git
|
apk add --no-cache git
|
||||||
# Git safe.directory 설정 (모든 경로 허용)
|
|
||||||
git config --global --add safe.directory '*'
|
git config --global --add safe.directory '*'
|
||||||
git config --global init.defaultBranch main # master 대신 main 사용
|
git config --global init.defaultBranch main # 모든 새 저장소 기본 브랜치 설정
|
||||||
|
|
||||||
TARGETS="$(params.targetProjects)"
|
TARGETS="$(params.targetProjects)"
|
||||||
SOURCES="$(params.sourceProjects)"
|
SOURCES="$(params.sourceProjects)"
|
||||||
@ -80,32 +79,32 @@ spec:
|
|||||||
SOURCES=$(echo "$SOURCES" | cut -s -d' ' -f2-)
|
SOURCES=$(echo "$SOURCES" | cut -s -d' ' -f2-)
|
||||||
TARGET_PATH="/workspace/base/$(params.context)/source/$(params.workspaceName)/${TARGET}"
|
TARGET_PATH="/workspace/base/$(params.context)/source/$(params.workspaceName)/${TARGET}"
|
||||||
|
|
||||||
|
# 소스 디렉터리 Git 초기화 (main 브랜치)
|
||||||
cd "$SRC"
|
cd "$SRC"
|
||||||
if [ ! -d .git ]; then
|
if [ ! -d .git ]; then
|
||||||
git init -b main
|
git init -b main # 명시적 main 브랜치 생성
|
||||||
git add .
|
git add .
|
||||||
git commit -m "init"
|
git commit -m "init"
|
||||||
fi
|
fi
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
# Nx 비대화형 임포트 실행
|
||||||
echo "Importing: $SRC → $TARGET_PATH"
|
echo "Importing: $SRC → $TARGET_PATH"
|
||||||
# npx nx import --sourceDirectory="$SRC" --destinationDirectory="$TARGET_PATH" --interactive=false --ref=main
|
npx nx import "$SRC" "$TARGET" \
|
||||||
npx nx import "$SRC" "$TARGET_PATH" \
|
--no-interactive \
|
||||||
--no-interactive \ # ✅ 올바른 비대화형 플래그
|
--branch=main \
|
||||||
--branch=main \ # 브랜치 명시
|
--sourceDirectory=.
|
||||||
--sourceDirectory=. \ # 소스 디렉터리 루트 지정
|
|
||||||
--destinationDirectory="$TARGET_PATH"
|
|
||||||
|
|
||||||
echo "Updating version to $(params.version)"
|
# 버전 업데이트
|
||||||
sed -i.bak "s/^version = .*/version = \"$(params.version)\"/" "$TARGET_PATH/Cargo.toml"
|
sed -i.bak "s/^version = .*/version = \"$(params.version)\"/" "$TARGET_PATH/Cargo.toml"
|
||||||
rm -f "$TARGET_PATH/Cargo.toml.bak"
|
rm -f "$TARGET_PATH/Cargo.toml.bak"
|
||||||
|
|
||||||
# destination(monorepo) 변경사항 커밋 또는 리셋
|
# 변경사항 커밋 (실패 시 무시)
|
||||||
git add .
|
git add .
|
||||||
git commit -m "auto-commit before nx import" || git reset --hard HEAD
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user