[FIX] @PropertySource 적용 #36
Workflow file for this run
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
name: Stepper Dev CI/CD | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Create env.properties | |
run: | | |
mkdir -p Stepper-backend/src/main/resources | |
touch Stepper-backend/src/main/resources/env.properties | |
- name: Write AWS_ACTION_ACCESS_KEY_ID | |
run: echo cloud.aws.credentials.accessKey=${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Write AWS_ACTION_SECRET_ACCESS_KEY | |
run: echo cloud.aws.credentials.secretKey=${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Write S3 bucket name | |
run: echo cloud.aws.s3.bucket=elasticbeanstalk-ap-northeast-2-880624269172 >> Stepper-backend/src/main/resources/env.properties | |
- name: Write S3 region | |
run: echo cloud.aws.region.static=ap-northeast-2 >> Stepper-backend/src/main/resources/env.properties | |
- name: Write DATABASE_URL | |
run: echo spring.datasource.url=${{ secrets.DATABASE_URL }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Write DATABASE_PASSWORD | |
run: echo spring.datasource.password=${{ secrets.DB_PASSWORD }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Write DATABASE_USERNAME | |
run: echo spring.datasource.username=${{ secrets.DB_USERNAME }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Write driver-class | |
run: echo spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver >> Stepper-backend/src/main/resources/env.properties | |
- name: Write JWT_SECRET_KEY | |
run: echo spring.jwt.secret=${{ secrets.JWT_SECRET }} >> Stepper-backend/src/main/resources/env.properties | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew clean build -x test | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" | |
- name: Show Current Time | |
run: echo "CurrentTime=${{ steps.current-time.outputs.formattedTime }}" | |
- name: Generate deployment package | |
run: | | |
mkdir -p deploy | |
cp build/libs/*.jar deploy/application.jar | |
cp Procfile deploy/Procfile | |
cp -r .ebextensions-dev deploy/.ebextensions | |
cp -r .platform deploy/.platform | |
cd deploy && zip -r deploy.zip . | |
- name: Beanstalk Deploy | |
uses: einaregilsson/beanstalk-deploy@v20 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
application_name: stepper-dev | |
environment_name: Stepper-dev-env | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: deploy/deploy.zip | |
wait_for_deployment: false |