5
5
- develop
6
6
jobs :
7
7
build-and-deploy :
8
- runs-on : ubuntu-20.04
8
+ runs-on : ${{ matrix.os }}
9
+ strategy :
10
+ matrix :
11
+ os : [windows-latest, macos-latest]
12
+
13
+ outputs :
14
+ build_outcome : ${{ steps.build_app.outcome }}
15
+ deploy_outcome : ${{ steps.deploy_web.outcome }}
16
+
9
17
steps :
10
18
- name : Checkout source code
11
19
uses : actions/checkout@v3
@@ -22,44 +30,62 @@ jobs:
22
30
- name : Install dependencies
23
31
run : yarn install
24
32
25
- - name : Generate web and Electron builds
26
- id : build
33
+ # 웹 빌드 및 S3 업로드 (macOS 환경에서만)
34
+ - name : Build Web App
35
+ id : build_web
36
+ if : matrix.os == 'macos-latest'
27
37
env :
28
38
VITE_API_BASE_URL : ${{ secrets.VITE_API_BASE_URL }}
29
39
VITE_OAUTH_KAKAO_REST_API_KEY : ${{ secrets.VITE_OAUTH_KAKAO_REST_API_KEY }}
30
40
VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE : ${{ secrets.VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE }}
31
41
VITE_OAUTH_KAKAO_REDIRECT_URI : ${{ secrets.VITE_OAUTH_KAKAO_REDIRECT_URI }}
32
42
run : |
33
- echo "Starting Web and Electron build ..."
34
- yarn electron: build
43
+ echo "Building web app ..."
44
+ yarn build
35
45
36
- - name : Deploy builds to S3
37
- id : deploy
38
- if : steps.build.outcome == 'success '
46
+ - name : Upload Web App to AWS S3
47
+ id : deploy_web
48
+ if : matrix.os == 'macos-latest '
39
49
env :
40
50
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
41
51
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42
52
run : |
43
53
echo "Deploying web build to S3..."
44
- aws s3 sync --region ap-northeast-2 dist/web s3://alignlab-client --delete
45
-
46
- echo "Deploying Electron build to S3..."
47
- ls out/make # 디렉토리 구조 확인
48
- ls out/make/squirrel.windows # 디렉토리 구조 확인
49
- aws s3 cp out/make/squirrel.windows/AlignLabInstaller.exe s3://alignlab-client/installer/AlignLabInstaller.exe --region ap-northeast-2
50
- aws s3 cp out/make/dmg/AlignLab.dmg s3://alignlab-client/installer/AlignLab.dmg --region ap-northeast-2
54
+ aws s3 sync dist/web s3://alignlab-client --delete --region ap-northeast-2
51
55
56
+ # Electron 빌드 및 GitHub Releases로 Publish
57
+ - name : Build and Publish Electron App
58
+ id : build_app
59
+ env :
60
+ VITE_API_BASE_URL : ${{ secrets.VITE_API_BASE_URL }}
61
+ VITE_OAUTH_KAKAO_REST_API_KEY : ${{ secrets.VITE_OAUTH_KAKAO_REST_API_KEY }}
62
+ VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE : ${{ secrets.VITE_OAUTH_KAKAO_CLIENT_SECRET_CODE }}
63
+ VITE_OAUTH_KAKAO_REDIRECT_URI : ${{ secrets.VITE_OAUTH_KAKAO_REDIRECT_URI }}
64
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65
+ run : yarn electron:publish
66
+ # CloudFront 캐시 무효화
67
+ invalidate-cache :
68
+ runs-on : ubuntu-20.04
69
+ needs : [build-and-deploy]
70
+ if : success()
71
+ steps :
52
72
- name : Invalidate CloudFront Cache
53
- if : steps.deploy.outcome == 'success'
54
73
env :
55
74
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
56
75
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
57
76
CLOUDFRONT_DISTRIBUTION_ID : ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
58
77
run : |
78
+ echo "Invalidating CloudFront cache..."
59
79
aws cloudfront create-invalidation --region ap-northeast-2 --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
60
80
81
+
82
+ # Discord 알림 - 성공
83
+ notify-success :
84
+ runs-on : ubuntu-20.04
85
+ needs : [build-and-deploy, invalidate-cache]
86
+ if : success()
87
+ steps :
61
88
- name : Discord notification - Success
62
- if : steps.deploy.outcome == 'success'
63
89
env :
64
90
DISCORD_WEBHOOK : ${{ secrets.DISCORD_DEPLOY_WEBHOOK }}
65
91
DISCORD_USERNAME : GitHub
@@ -68,27 +94,28 @@ jobs:
68
94
with :
69
95
args : |
70
96
🎉 배포가 성공적으로 완료되었습니다!
97
+ 다운로드 링크: https://github.com/${{ github.repository }}/releases/latest
98
+ 웹 앱 링크: https://alignlab-client.s3.ap-northeast-2.amazonaws.com/index.html
71
99
브랜치: develop
72
- 커밋: ${{ steps.get_commit_info.outputs.message }}
73
- 작성자: ${{ steps.get_commit_info.outputs.author }}
100
+ 커밋: ${{ needs.build-and-deploy. steps.get_commit_info.outputs.message }}
101
+ 작성자: ${{ needs.build-and-deploy. steps.get_commit_info.outputs.author }}
74
102
103
+ # Discord 알림 - 실패
104
+ notify-failure :
105
+ runs-on : ubuntu-20.04
106
+ needs : [build-and-deploy]
107
+ if : failure()
108
+ steps :
75
109
- name : Discord notification - Failure
76
- if : steps.build.outcome == 'failure' || steps.deploy.outcome == 'failure'
77
110
env :
78
111
DISCORD_WEBHOOK : ${{ secrets.DISCORD_DEPLOY_WEBHOOK }}
79
- DISCORD_USERNAME : GitHub
80
- DISCORD_AVATAR : https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
81
112
uses : Ilshidur/action-discord@master
82
113
with :
83
114
args : |
84
- ❌ ${{ steps .build.outcome == 'failure' && '빌드 중' || '배포 중' }} 오류가 발생했습니다.
115
+ ❌ ${{ needs .build-and-deploy.outputs.build_outcome == 'failure' && '빌드 중' || '배포 중' }} 오류가 발생했습니다.
85
116
브랜치: develop
86
- 커밋: ${{ steps.get_commit_info.outputs.message }}
117
+ 커밋: ${{ needs.build-and-deploy. steps.get_commit_info.outputs.message }}
87
118
작성자: <@${{ secrets.DISCORD_ID_1 }}>
88
119
실패한 워크플로우: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
89
- ${{ steps.build.outcome == 'failure' && '빌드 오류 메시지:' || '' }}
90
- ${{ steps.build.outcome == 'failure' && steps.build.outputs.stderr || '' }}
91
-
92
- - name : Check deploy result
93
- if : steps.build.outcome == 'failure' || steps.deploy.outcome == 'failure'
94
- run : exit 1
120
+ ${{ needs.build-and-deploy.outputs.build_outcome == 'failure' && '빌드 오류 메시지:' || '' }}
121
+ ${{ needs.build-and-deploy.outputs.build_outcome == 'failure' && needs.build-and-deploy.steps.build_app.outputs.stderr || '' }}
0 commit comments