This commit is contained in:
병준 박 2025-04-25 22:56:11 +00:00
parent f87c675025
commit b2a4a8a1f6

View File

@ -13,6 +13,11 @@ spec:
Accepts space-separated project pairs for bulk operations.
params:
- name: context
type: string
description: context directory
default: ""
- name: targetProjects
type: string
description: "Space-separated target project paths in monorepo (e.g., 'libs/auth libs/payment')"
@ -32,15 +37,15 @@ spec:
default: "unbox-x"
workspaces:
- name: source
description: Workspace containing source projects
- name: repo
description: Git repository workspace
- name: base
steps:
- name: import-projects
image: node:18-alpine
workingDir: $(workspaces.repo.path)
workingDir: /workspace/base/$(params.context)/source
env:
- name: HOME
value: /workspace/base/$(params.context)/home
script: |
#!/bin/sh
set -ex
@ -59,11 +64,12 @@ spec:
# Process each project pair
for i in $(seq 0 $((${#TARGETS[@]}-1))); do
SRC="$(workspaces.source.path)/${SOURCES[$i]}"
SRC="${SOURCES[$i]}"
TARGET="${TARGETS[$i]}"
echo "Importing: ${SRC} → ${TARGET}"
nx import "${SRC}" --destination="${TARGET}" --importPath=$(basename "${TARGET}")
# nx import "${SRC}" --destination="${TARGET}" --importPath=$(basename "${TARGET}")
nx import "${SRC}" "${TARGET}"
echo "Updating version to $(params.version)"
sed -i.bak "s/^version = .*/version = \"$(params.version)\"/" "${TARGET}/Cargo.toml"
@ -72,12 +78,13 @@ spec:
- name: git-commit
image: alpine/git:latest
workingDir: $(workspaces.repo.path)
workingDir: /workspace/base/$(params.context)/source
env:
- name: HOME
value: /workspace/base/$(params.context)/home
script: |
#!/bin/sh
set -e
git config --global user.name "tekton-bot"
git config --global user.email "tekton@example.com"
git add .
git commit -m "chore: merge projects (version $(params.version))" || exit 0
git push origin HEAD:main