-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (47 loc) · 1.56 KB
/
deploy.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
48
49
50
51
52
53
54
55
56
57
58
59
name: Gh Pages Deploy
on:
push:
branches:
- main
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Detect changes and run build
id: detect-changes
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }})
echo "Changed files: $CHANGED_FILES"
# 미션이 있는 주
WEEKS=("week1" "week2")
for WEEK in "${WEEKS[@]}"; do
if [ -d "$WEEK" ]; then # 해당 주차 폴더가 존재하는지 확인
echo "Checking projects in $WEEK"
# 해당 주차 폴더 하위의 모든 프로젝트 폴더를 읽어서 순회
for PROJECT in $(ls -d $WEEK/*/); do
PROJECT=${PROJECT%/} # 디렉토리 이름에서 마지막 '/' 제거
if echo "$CHANGED_FILES" | grep -q "$PROJECT/"; then
echo "Running build for $PROJECT"
pnpm --filter "$PROJECT" build
fi
done
fi
done
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
run: |
pnpm run deploy