back deploy for prod #122
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: back deploy for prod | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0.28 | |
env: | |
MYSQL_USER: user | |
MYSQL_PASSWORD: password | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: prolog | |
ports: | |
- 13306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/[email protected] | |
with: | |
java-version: 1.8 | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
working-directory: backend | |
- name: Build with Gradle | |
run: ./gradlew flywayClean flywayBaseline flywayMigrate bootJar -Dflyway.baselineVersion=0 | |
shell: bash | |
working-directory: backend | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" | |
- name: Generate deployment package | |
run: | | |
cd backend | |
mkdir -p deploy | |
cp build/libs/*.jar deploy/application.jar | |
cp -r .ebextensions deploy/.ebextensions | |
cd deploy && zip -r deploy.zip . | |
- name: Deploy to EB | |
uses: einaregilsson/beanstalk-deploy@v16 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: pro-log | |
environment_name: Prolog-env-prod | |
version_label: github-action-${{steps.current-time.outputs.formattedTime}} | |
region: ap-northeast-2 | |
deployment_package: backend/deploy/deploy.zip |