refactor: nginx #90
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: ddabong | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Convert to dev YML | |
run: | | |
cd ./src/main/resources | |
[ -e "application.yml" ] && rm application.yml | |
echo "spring:" >> application.yml | |
echo " profiles:" >> application.yml | |
echo " active: dev" >> application.yml | |
echo " servlet:" >> application.yml | |
echo " multipart:" >> application.yml | |
echo " max-file-size: 200MB" >> application.yml | |
echo " max-request-size: 200MB" >> application.yml | |
- name: Set dev.yml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./src/main/resources/application-dev.yml | |
env: | |
spring.datasource.url: ${{ secrets.DB_URL }} | |
spring.datasource.username: ${{ secrets.DB_USER }} | |
spring.datasource.password: ${{ secrets.DB_PW }} | |
jwt.secret: ${{ secrets.SECURITY_KEY }} | |
cloud.aws.region.static: ${{ secrets.AWS_REGION }} | |
cloud.aws.s3.bucket: ${{ secrets.S3_BUCKET }} | |
cloud.aws.credentials.accessKey: ${{ secrets.S3_ACCESS_KEY }} | |
cloud.aws.credentials.secretKey: ${{ secrets.S3_SECRET_KEY }} | |
redis.host: ${{ secrets.REDIS_HOSTNAME }} | |
redis.port: ${{ secrets.REDIS_PORT }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build with Gradle | |
run: ./gradlew clean build -x test | |
shell: bash | |
- 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}}" | |
shell: bash | |
- 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 | |
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: project-prod-ddabong | |
environment_name: Project-prod-ddabong-env | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: deploy/deploy.zip | |
wait_for_deployment: false |