Merge pull request #18 from donsonioc2010/docs/ci-cd #9
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: Picasso CI/CD | |
on: | |
push: | |
branches: [ "dev", "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Picasso CI/CD | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Action Version Checkout | |
uses: actions/checkout@v2 | |
- name: Setup jdk-17 | |
uses: actions/setup-java@main | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Test with Gradle | |
run: ./gradlew test | |
- name: Build with Gradle | |
run: ./gradlew build | |
# Proxy Server Connect with SSH | |
# scp로 proxy server에 build된 Jar 파일을 보낸다 | |
# jar 파일을 실행한다. 이 때 storage에 대한 VM Option을 추가하여 실행한다. | |
- name: Deploy From Github Action to Application Server via Proxy Server | |
uses: appleboy/scp-action@master | |
with: | |
proxy_host: ${{ secrets.NCP_PROXY_HOST }} | |
proxy_username: root | |
proxy_key: ${{ secrets.NCP_PEM }} | |
proxy_port: 2222 | |
host: ${{ secrets.NCP_APP_HOST }} | |
username: root | |
key: ${{ secrets.NCP_PEM }} | |
port: 22 | |
source: ./Api/build/libs/app.jar | |
target: /var/app | |
script: | | |
pwd | |
cd /var/app | |
ls -al | |
cd ../.. | |
java -jar ./var/app/app.jar -Dnaver.storage.access-key=${{ secrets.ACCESS_KEY }} -Dnaver.storage.secret-key=${{ secrets.SECRET_KEY }} |