Skip to content

Commit aec4316

Browse files
committed
feat: test workflow 수정
1 parent 5c21d77 commit aec4316

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/develop-cd.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ on:
44
push:
55
branches:
66
- test
7+
pull_request:
8+
branches:
9+
- test
710
workflow_dispatch:
811
inputs:
912
branch:
10-
description: "Select the branch to build and deploy"
13+
description: 'Select the branch to build and deploy'
1114
required: true
12-
default: "main"
15+
default: 'main'
1316
type: choice
1417
options:
1518
- test
@@ -55,13 +58,23 @@ jobs:
5558
echo "Building for branch: ${{ github.event.inputs.branch || github.ref_name }}"
5659
npm run build
5760
58-
- name: Deploy
61+
- name: Deploy to s3
62+
uses: jakejarvis/s3-sync-action@master
63+
with:
64+
args: --delete
5965
env:
60-
SSH_PRIVATE_KEY: ${{ secrets.TEST_SSH_SECRETE }}
61-
EC2_HOST: ${{ secrets.TEST_EC2_HOST }}
62-
EC2_USERNAME: ${{ secrets.TEST_EC2_USERNAME }}
66+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
67+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
68+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69+
AWS_REGION: ${{ secrets.AWS_REGION }}
70+
SOURCE_DIR: 'dist'
71+
72+
- name: Invalidate CloudFront Cache
6373
run: |
64-
echo -e "$SSH_PRIVATE_KEY" > key.pem
65-
chmod 600 key.pem
66-
scp -o StrictHostKeyChecking=no -i key.pem -r dist/* $EC2_USERNAME@$EC2_HOST:/var/www/html/
67-
ssh -o StrictHostKeyChecking=no -i key.pem $EC2_USERNAME@$EC2_HOST "sudo systemctl restart nginx"
74+
aws cloudfront create-invalidation \
75+
--distribution-id ${{ secrets.CLOUDFRONT_ID }} \
76+
--paths "/index.html" "/"
77+
env:
78+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
79+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
80+
AWS_REGION: ${{ secrets.AWS_REGION }}

0 commit comments

Comments
 (0)