Skip to content

Merge pull request #97 from Triumers/feat/comment #46

Merge pull request #97 from Triumers/feat/comment

Merge pull request #97 from Triumers/feat/comment #46

Workflow file for this run

name: Deploy-service
permissions:
contents: read
pull-requests: write
on:
push:
branches: ["main", "dev"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Install envsubst
run: sudo apt-get install -y gettext
- name: Make application.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.DB_YML }}" | base64 --decode > src/main/resources/application.yml
find src
- name: Make gradle.properties
run: |
echo "${{ secrets.GRADLE_PROPERTIES }}" | base64 --decode > gradle.properties
- name: Gradle 빌드
run: ./gradlew clean build
env:
DB_URL: ${{ secrets.DB_URL }}
DB_USER_NAME: ${{ secrets.DB_USER_NAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
- 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
JAR_FILE=$(find build/libs -name "*.jar" | head -n 1)
cp "$JAR_FILE" deploy/application.jar
cp Procfile deploy/Procfile
mkdir -p deploy/.ebextensions
mkdir -p deploy/.platform
if [ -d ".ebextensions" ]; then cp -r .ebextensions/* deploy/.ebextensions/; fi
if [ -d ".platform" ]; then cp -r .platform/* deploy/.platform/; fi
cd deploy && zip -r deploy.zip .
- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: Triumers-Back
environment_name: Triumers-Back-env
version_label: github-action-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: deploy/deploy.zip