docs: readme update #112
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: Dev code deploy | |
on: | |
push: | |
branches: [ "dev2" ] | |
pull_request: | |
branches: [ "dev2" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # 또는 프로젝트에서 사용하는 Node.js 버전 | |
- name: Install dependencies | |
run: | | |
cd front | |
npm install | |
- name: Make deploy script executable | |
run: chmod +x ./deploy.sh | |
- name: Run deploy script | |
run: ./deploy.sh | |
- name: Add SSH fixkey to known hosts | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan ${{ secrets.DEV_TWO_TOMCAT_SSH_HOST }} >> ~/.ssh/known_hosts | |
ssh-keyscan ${{ secrets.DEV_TWO_ASYNC_SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Create SSH key | |
run: | | |
echo "${{ secrets.PEM_KEY }}" > private_key | |
chmod 600 private_key | |
- name: Deploy To EC2 | |
env: | |
ACTIVE_PROFILE: dev | |
run: | | |
scp -i private_key ./api/build/libs/*.jar ${{ secrets.DEV_TWO_TOMCAT_SSH_FULL_INFO }}:~/ | |
scp -i private_key ./consumer/build/libs/*.jar ${{ secrets.DEV_TWO_ASYNC_SSH_FULL_INFO }}:~/ | |
ssh -i private_key ${{ secrets.DEV_TWO_TOMCAT_SSH_FULL_INFO }} "sudo bash ${{ secrets.SCRIPT_PATH }} $ACTIVE_PROFILE" | |
ssh -i private_key ${{ secrets.DEV_TWO_ASYNC_SSH_FULL_INFO }} "sudo bash ${{ secrets.SCRIPT_PATH }} $ACTIVE_PROFILE" |