Merge pull request #61 from team9502/dev #10
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: 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: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: gradlew bootJar | |
run: ./gradlew 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 }}03 | |
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 }} |