-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.46 KB
/
update-upstream.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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: 업스트림 저장소 업데이트"