Skip to content

update deploy.sh

update deploy.sh #22

Workflow file for this run

on:
push:
branches:
- main
name: Deploy String boot to Amazon EC2
env:
PROJECT_NAME: board
jobs:
deploy:
name: DEPLOY
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set Yaml
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-prod.yml
env:
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USER_NAME }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew build
shell: bash
- name: Make zip file
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://simple-board-deploy/$PROJECT_NAME/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name simple-board --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name dev --s3-location bucket=simple-board-deploy,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip