๐ [Fix] socialLink (#145) #50
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
# Dependency Install, Build, Start๋ฅผ ์ฌ๊ธฐ์ ๋คํฉ๋๋ค. | |
name: Dev Deploy to AWS | |
on: | |
workflow_dispatch: | |
inputs: | |
comment: | |
description: '์๋ trigger ์ฌ์ ' | |
default: 'ex) ์๋ฒ ์ค์ ๋ณ๊ฒฝ ๋ฑ' | |
push: | |
branches: | |
- develop | |
paths: | |
- 'src/**' # source code | |
- 'e2e/**' # e2e test | |
- 'package.json' # ์์กด์ฑ | |
- 'package-lock.json' # ์์กด์ฑ | |
- 'prisma/**' # prisma, bin file/schema | |
- 'tsconfig.json' # tsconfig | |
- 'tsconfig.build.json' # tsconfig | |
- 'appspec.yml' # codedeploy | |
env: | |
AWS_REGION: ap-northeast-2 | |
jobs: | |
deploy: | |
permissions: | |
id-token: write | |
contents: write | |
name: Development Deploy Application | |
runs-on: ubuntu-22.04 | |
outputs: | |
deploymentId: ${{ steps.create-deployment.outputs.deploymendId }} | |
environment: development | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Secret | |
env: | |
# github repository ์์ ENV_PROD ํ๊ฒฝ๋ณ์ ์ฌ์ฉ | |
ENV_DEV: ${{ secrets.ENV_DEV }} | |
run: | | |
echo "$ENV_DEV" >> .env | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.0 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}. | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- run: npx prisma generate | |
- run: npm run build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
#Code Deploy๋ฅผ ์ฌ์ฉํด S3 bucket์ ์์ค์ฝ๋ ์ ๋ก๋ | |
- name: S3 ์ ๋ก๋ | |
run: | | |
zip --symlinks -r server.zip . | |
aws s3 cp server.zip s3://manito42-code-deploy-bucket-test/server.zip | |
- name: Create CodeDeploy Deployment | |
id: create-deployment | |
run: | | |
id=$(aws deploy create-deployment \ | |
--application-name 42manito-development-cd \ | |
--deployment-config-name CodeDeployDefault.OneAtATime \ | |
--output text --deployment-group-name 42manito-development-deployment-group \ | |
--file-exists-behavior OVERWRITE \ | |
--s3-location bucket=manito42-code-deploy-bucket-test,bundleType=zip,key=server.zip) | |
echo "deploymentId=$id" >> $GITHUB_OUTPUT | |
- name: Wait for deployment to finish | |
run: | | |
echo ${{ steps.create-deployment.outputs.deploymentId }} | |
aws deploy wait deployment-successful --deployment-id ${{ steps.create-deployment.outputs.deploymentId }} |