-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7f59a9
commit 84aa7c6
Showing
1 changed file
with
24 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,60 @@ | ||
|
||
name: deploy to aws s3 | ||
# 1. 트리거 생성(main브랜치에 push 될때 현재 스크립트 실행 트리거 발동) | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
# 워크플로우는 하나 이상의 작업(job)으로 구성, 여기서는 하나의 작업만을 정의 (job의 이름 은 사용자 맘대로) | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on : ubuntu-latest | ||
# 각 작업은 여러 step(단계)로 구성 | ||
runs-on: ubuntu-latest | ||
steps: | ||
# actions 는 github에서 제공되는 공식 워크플로우 | ||
# chekout은 현재 repo의 main브랜치 소스코드를 카피 | ||
# 1. 소스 코드 체크아웃 | ||
- name: source code checkout | ||
uses: actions/checkout@v2 | ||
# 2. 노드 설치 | ||
|
||
# 2. Node.js 설정 | ||
- name: setup node jobs | ||
uses: actions/setup-node@v2 | ||
with: | ||
with: | ||
node-version: '20' | ||
|
||
# 3. .env 파일 생성 | ||
- name: Create .env file | ||
run: | | ||
echo "VUE_APP_API_BASE_URL=${{ secrets.VUE_APP_API_BASE_URL }}" >> .env | ||
# 3. npm install | ||
# 4. .npmrc 파일 생성 (토큰을 GitHub Secrets에서 가져옴) | ||
- name: Create .npmrc file | ||
run: | | ||
echo "@tiptap-pro:registry=https://registry.tiptap.dev/" >> .npmrc | ||
echo "//registry.tiptap.dev/:_authToken=${{ secrets.Tiptap_Auth_Token }}" >> .npmrc | ||
# 5. npm install | ||
- name: npm install | ||
working-directory: . | ||
run: npm install | ||
# 4. npm build | ||
- name: npm buildwer | ||
|
||
# 6. npm 빌드 | ||
- name: npm build | ||
working-directory: . | ||
run: npm run build | ||
|
||
|
||
# 7. AWS CLI 설정 | ||
- name: setup aws cli | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{secrets.AWS_ACESS_KEY}} | ||
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY}} | ||
aws-secret-access-key: ${{secrets.AWS_SECRET}} | ||
aws-region: ap-northeast-2 | ||
|
||
# 8. S3 버킷 정리 | ||
- name: clear s3 bucket | ||
run: aws s3 rm s3://coconote.site/ --recursive | ||
|
||
# 9. 빌드 파일 S3에 업로드 | ||
- name: upload file in s3 bucket | ||
run: aws s3 cp ./dist s3://coconote.site/ --recursive | ||
|
||
|
||
# 10. CloudFront 캐시 무효화 | ||
- name: invalidate cloudfront cache | ||
run: aws cloudfront create-invalidation --distribution-id ${{secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/*" |