Skip to content

climbing

climbing #47

Workflow file for this run

name: climb
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
# CI
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Set AwsS3 Key at yaml
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application-ci.yml, ./src/main/resources/application-prod.yml
env:
aws.s3.bucket: ${{ secrets.AWS_S3_BUCKET }}
aws.s3.accessKey: ${{ secrets.AWS_S3_ACCESS_KEY }}
aws.s3.secretKey: ${{ secrets.AWS_S3_SECRET_KEY }}
- name: Set RDS datasource at 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_USERNAME }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
- name: Grant execute permission to gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time # 현재 시간(+9)이 id에 담김
with:
format: YYYY-MM-DDTHH-mm-ss
utfOffset: "+09:00"
- name: Show Current Time
run: echo "${{steps.current-time.outputs.formattedTime}}"
- name: Create deployment zip file
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cd deploy && zip -r deploy.zip .
# EB에 배포
- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
application_name: climbing-api
environment_name: Climbing-api-env
version_label: climbing-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: deploy/deploy.zip