본문으로 건너뛰기

스크립트

trigger:
branches:
include:
- main

jobs:

# 첫 번째 Job: 기존 docusaurus 업데이트

- job: UpdateDocusaurusRepo
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
displayName: 'Checkout Docs Repository'
- script: |

# 작성자 및 커미터 정보 환경 변수 설정

export GIT_COMMITTER_NAME="`사용자 이름`"
export GIT_COMMITTER_EMAIL="`사용자 이메일`"
export GIT_AUTHOR_NAME="`사용자 이름`"
export GIT_AUTHOR_EMAIL="`사용자 이메일`"

# Git 작성자 정보 명시적으로 설정

git config user.name "$GIT_COMMITTER_NAME"
git config user.email "$GIT_COMMITTER_EMAIL"

# 설정 확인 (로그 출력)

echo "GIT_COMMITTER_NAME is set to $GIT_COMMITTER_NAME"
echo "GIT_COMMITTER_EMAIL is set to $GIT_COMMITTER_EMAIL"
echo "GIT_AUTHOR_NAME is set to $GIT_AUTHOR_NAME"
echo "GIT_AUTHOR_EMAIL is set to $GIT_AUTHOR_EMAIL"
git config --list

# docusaurus 레포지토리 clone

git clone https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/`프로젝트 이름`/_git/docusaurus
cd docusaurus

# docs 레포지토리의 main 브랜치를 docusaurus의 docs 폴더에 서브트리로 pull

git subtree pull --prefix=docs https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/`프로젝트 이름`/_git/docs main --squash

# 변경 사항을 커밋하고 푸시

git add docs
git commit -m "Automated update of docs folder from docs repository on $(date)"
git push origin main
displayName: 'Update Docusaurus Repository'

# 두 번째 Job: SSOT 프로젝트의 docusaurus_intro 업데이트

- job: UpdateSSOTDocusaurusIntroRepoMain
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
displayName: 'Checkout `프로젝트 이름` Docs Repository for SSOT Update'
- script: |

# 환경 변수 설정

export GIT_COMMITTER_NAME="`사용자 이름`"
export GIT_COMMITTER_EMAIL="`사용자 이메일`"
export GIT_AUTHOR_NAME="`사용자 이름`"
export GIT_AUTHOR_EMAIL="`사용자 이메일`"

# Git 작성자 정보 명시적으로 설정

git config user.name "$GIT_COMMITTER_NAME"
git config user.email "$GIT_COMMITTER_EMAIL"

# SSOT 프로젝트의 docusaurus_intro 레포지토리 clone

git clone https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/SSOT%28Single%20Source%20Of%20Truth%29/_git/docusaurus_intro -b main
cd docusaurus_intro

# docs 레포지토리의 main 브랜치를 docusaurus_intro의 `docs 폴더 이름` 폴더에 서브트리로 pull

git subtree pull --prefix=`docs 폴더 이름` https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/`프로젝트 이름`/_git/docs main --squash

# 변경 사항을 커밋하고 푸시

git add `docs 폴더 이름`
git commit -m "Automated update of `docs 폴더 이름` folder from `프로젝트 이름` docs repository on $(date)"
git push origin main
displayName: 'Update SSOT Docusaurus Intro Repository'

# 세 번째 Job: SSOT 프로젝트의 docusaurus_intro master에 업데이트

- job: UpdateSSOTDocusaurusIntroRepoMaster
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
displayName: 'Checkout `프로젝트 이름` Docs Repository for SSOT Update'
- script: |

# 환경 변수 설정

export GIT_COMMITTER_NAME="`사용자 이름`"
export GIT_COMMITTER_EMAIL="`사용자 이메일`"
export GIT_AUTHOR_NAME="`사용자 이름`"
export GIT_AUTHOR_EMAIL="`사용자 이메일`"

# Git 작성자 정보 명시적으로 설정

git config user.name "$GIT_COMMITTER_NAME"
git config user.email "$GIT_COMMITTER_EMAIL"

# SSOT 프로젝트의 docusaurus_intro 레포지토리 clone

git clone https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/SSOT%28Single%20Source%20Of%20Truth%29/_git/docusaurus_intro -b master
cd docusaurus_intro

# docs 레포지토리의 main 브랜치를 docusaurus_intro의 `docs 폴더 이름` 폴더에 서브트리로 pull

git subtree pull --prefix=`docs 폴더 이름` https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/`프로젝트 이름`/_git/docs main --squash

# 변경 사항을 커밋하고 푸시

git add `docs 폴더 이름`
git commit -m "Automated update of `docs 폴더 이름` folder from `프로젝트 이름` docs repository on $(date)"
git push origin master
displayName: 'Update SSOT Docusaurus Intro Repository'

# 🔹 네 번째 Job: 개발 레포에 51. development 폴더 동기화

- job: Sync51DevelopmentToProjectRepos
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
displayName: 'Checkout Docs Repository for 51. development Update'
- script: |

# Git 작성자 정보 설정

export GIT_COMMITTER_NAME="`사용자 이름`"
export GIT_COMMITTER_EMAIL="`사용자 이메일`"
export GIT_AUTHOR_NAME="`사용자 이름`"
export GIT_AUTHOR_EMAIL="`사용자 이메일`"

git config user.name "$GIT_COMMITTER_NAME"
git config user.email "$GIT_COMMITTER_EMAIL"

echo "Git user config completed."

# 51. development 폴더 복사

mkdir -p temp
cp -r "51. development"/* temp/

REPOS=("`적용할 개발 레포명1`" "`적용할 개발 레포명2`" "`적용할 개발 레포명3`" "`적용할 개발 레포명4`")

for REPO in "${REPOS[@]}"; do
echo "Updating $REPO..."

# 레포 클론 및 브랜치 변경 (dev 브랜치가 없는 경우 생성)

git clone https://$(AZURE_DEVOPS_PAT)@dev.azure.com/Security365/`프로젝트 이름`/_git/$REPO
cd $REPO
git checkout dev || git checkout -b dev origin/dev

# ✅ 51. development 폴더 생성 및 복사

mkdir -p "51. development"
cp -r ../temp/* "51. development/"

# ✅ .gitignore에서 51. development가 무시되지 않도록 처리

if grep -q "51. development/" .gitignore; then
echo "Removing '51. development/' from .gitignore"
sed -i '/51\. development\//d' .gitignore
fi

# ✅ 변경 사항 커밋 및 푸시

git add .
if git diff --cached --quiet; then
echo "No changes to commit in $REPO"
else
git commit -m "Sync '51. development' folder from docs repository on $(date)"
git push origin dev
fi

cd ..
rm -rf $REPO
done
displayName: 'Sync 51. development folder to Project Repositories'

변수 설정 가이드

변수 이름설명예시확인 방법
사용자 이름git 사용자 이름Namgyu OhVS Code 터미널에서 git config --global user.name 입력
사용자 이메일git 사용자 이메일namgyu.oh@softcamp.co.krVS Code 터미널에서 git config --global user.email 입력
프로젝트 이름docs 레포지토리의 프로젝트 이름SHIELDriveAzure DevOps 사이트 메인 페이지에서 확인
docs 폴더 이름SSOT 프로젝트 docusaurus_intro 레포지토리 안에 적용할 docs 폴더 이름docs-shieldriveSSOT 프로젝트 >docusaurus_intro 레포지토리에서 확인
적용할 개발 레포명풀리퀘스트 진행할 개발 레포지토리 이름SHIELDrive_FE제품 프로젝트 > 개발 레포지토리명 확인