Update upstream #1223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update upstream | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 * * * *" # 매시간마다 작동 | |
jobs: | |
update-upstream: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: 소스코드 체크아웃 | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: 서브모듈 경로 파싱 | |
run: | | |
submodule_paths=$(awk -F ' = ' '/path/ {printf $2","}' .gitmodules) | |
submodule_paths=${submodule_paths%,} # 마지막 쉼표 제거 | |
echo "submodule_paths=$submodule_paths" >> $GITHUB_ENV | |
- name: 저장소 정보 업데이트 | |
run: | | |
git submodule init | |
git submodule update --remote | |
- name: 서브모듈 태그 업데이트 | |
run: | | |
IFS=',' read -ra ADDR <<< "${{ env.submodule_paths }}" | |
for path in "${ADDR[@]}"; do | |
cd $path | |
git fetch --tags | |
cd - | |
done | |
- name: 마지막 태그로 체크아웃한다 | |
run: | | |
IFS=',' read -ra ADDR <<< "${{ env.submodule_paths }}" | |
for path in "${ADDR[@]}"; do | |
cd $path | |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
git checkout $latest_tag | |
cd - | |
done | |
- name: 변경사항 업데이트 | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "chore: 업스트림 저장소 업데이트" |