[UNI-255] test를 위한 임시 커밋 #117
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: Uniro-server CD | |
on: | |
push: | |
branches: | |
- be | |
- refactor/UNI-255-v3 | |
jobs: | |
uniro-ci: | |
name: Build & Push Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
- name: Create application.properties from secret | |
run: | | |
echo "${{ secrets.BE_SPRING_APPLICATION_SECRET }}" > ./uniro_backend/src/main/resources/application.properties | |
shell: bash | |
- name: Build Spring Boot Application | |
run: | | |
cd uniro_backend | |
./gradlew clean build -x test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker Hub Login | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} | |
- name: Build & Push Multi-Arch Docker Image | |
run: | | |
cd uniro_backend | |
docker buildx create --use | |
docker buildx build --platform linux/amd64,linux/arm64 -t uniro5th/uniro-docker-repo:develop --build-arg SPRING_PROFILE=dev --push . | |
deploy-run: | |
name: Deploy to Server | |
needs: uniro-ci | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run Docker Container on Server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.BE_SERVER_IP }} | |
username: ${{ secrets.BE_SERVER_USER }} | |
key: ${{ secrets.BE_SERVER_KEY }} | |
script: | | |
cd ~/myapp | |
chmod +x ./deploy.sh | |
./deploy.sh |