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'