-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 2.1 KB
/
main.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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Build with Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.1.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: project-moviesite
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: mkdir deploy
- run: cp -r dist deploy
- run: cp appspec.yml deploy
- run: cp deploy.sh deploy
- name: Make zip file
# run: zip -r -qq -j ./moviesite-front-$GITHUB_SHA.zip ./dist ./appspec.yml ./deploy.sh
# run: tar cvf ./moviesite-front-$GITHUB_SHA.tar ./dist ./appspec.yml ./deploy.sh
run: tar cvf ./moviesite-front-$GITHUB_SHA.tar ./deploy
- name: Configure AWS Credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SECRET_ACCESS_KEY }}
# Upload to S3
- name: Upload to S3
run: aws s3 cp --region $AWS_REGION --acl private ./moviesite-front-$GITHUB_SHA.tar s3://$S3_BUCKET_NAME/moviesite-front-$GITHUB_SHA
- name: CodeDeploy
env:
CODEDEPLOY_NAME: MovieSiteWeb
CODEDEPLOY_GROUP: moviesite-web-group
run: aws deploy create-deployment --application-name $CODEDEPLOY_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $CODEDEPLOY_GROUP --s3-location bucket=$S3_BUCKET_NAME,bundleType=tar,key=moviesite-front-$GITHUB_SHA