refactor : User desc 필드 추가 (#135) #79
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: ALGOHUB Deploy | |
on: | |
push: | |
branches: | |
- develop | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: JDK 21 Setup | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Create mysql.yml | |
run: echo "${{ secrets.MYSQL_YML }}" | base64 --decode > src/main/resources/mysql.yml | |
- name: Create aws.yml | |
run: echo "${{ secrets.AWS_YML }}" | base64 --decode > src/main/resources/aws.yml | |
- name: Create jwt.yml | |
run: echo "${{ secrets.JWT_YML }}" | base64 --decode > src/main/resources/jwt.yml | |
- name: Create application.yml | |
run: echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > src/main/resources/application.yml | |
- name: Test YML | |
run: ls -l src/main/resources | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
uses: gradle/[email protected] | |
with: | |
arguments: build -x test | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: algohub | |
path: build/libs/algohub-0.0.1-SNAPSHOT.jar | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: algohub | |
path: build/libs/ | |
- name: Deploy to EC2 | |
run: | | |
echo "${{ secrets.EC2_SSH_KEY }}" > private_key.pem | |
chmod 400 private_key.pem | |
sudo scp -i private_key.pem -o StrictHostKeyChecking=no build/libs/algohub-0.0.1-SNAPSHOT.jar ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USERNAME }}/algohub.jar | |
sudo ssh -i private_key.pem -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} "pgrep java | xargs kill -9; nohup java -jar /home/${{ secrets.EC2_USERNAME }}/algohub.jar > app.log 2>&1 &" | |
rm -f private_key.pem |