Skip to content

Merge pull request #62 from team9502/dev #13

Merge pull request #62 from team9502/dev

Merge pull request #62 from team9502/dev #13

Workflow file for this run

name: sinChul
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Set up cache for Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Generate QueryDSL Q classes
run: ./gradlew compileQuerydsl
- name: Build and create bootJar
run: ./gradlew clean bootJar
- name: Copy jar to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ec2-user
key: ${{ secrets.SSH_KEY }}
port: 22
source: "./build/libs/*.jar"
target: "/home/ec2-user"
strip_components: 2
- name: SSH Commands
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ec2-user
key: ${{ secrets.SSH_KEY }}
port: 22
script_stop: true
script: |
export JDBC_URL="${{ secrets.JDBC_URL }}"
export JDBC_USERNAME="${{ secrets.JDBC_USERNAME }}"
export JDBC_PASSWORD="${{ secrets.JDBC_PASSWORD }}"
export ENCRYPTION_SECRET_KEY="${{ secrets.ENCRYPTION_SECRET_KEY }}"
export JWT_SECRETKEY="${{ secrets.JWT_SECRETKEY }}"
export API_SERVICE_KEY="${{ secrets.API_SERVICE_KEY }}"
export S3_ACCESS_KEY="${{ secrets.S3_ACCESS_KEY }}"
export S3_NAME="${{ secrets.S3_NAME }}"
export S3_REGION="${{ secrets.S3_REGION }}"
export SECRET_ACCESS_KEY="${{ secrets.SECRET_ACCESS_KEY }}"
# JAR ํŒŒ์ผ์„ /home/ec2-user ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ์‹คํ–‰
nohup java -jar /home/ec2-user/*.jar > nohup.out 2>&1 &
env:
JDBC_URL: ${{ secrets.JDBC_URL }}
JDBC_USERNAME: ${{ secrets.JDBC_USERNAME }}
JDBC_PASSWORD: ${{ secrets.JDBC_PASSWORD }}
ENCRYPTION_SECRET_KEY: ${{ secrets.ENCRYPTION_SECRET_KEY }}
JWT_SECRETKEY: ${{ secrets.JWT_SECRETKEY }}
API_SERVICE_KEY: ${{ secrets.API_SERVICE_KEY }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_NAME: ${{ secrets.S3_NAME }}
S3_REGION: ${{ secrets.S3_REGION }}
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}