Skip to content

✨ [STMT-266] 관리자 위임 API 구현 (#150) #96

✨ [STMT-266] 관리자 위임 API 구현 (#150)

✨ [STMT-266] 관리자 위임 API 구현 (#150) #96

Workflow file for this run

# github repository actions 페이지에 나타날 이름
name: CI/CD using github actions & docker
# event trigger
on:
push:
branches: [ "main", "dev" ]
permissions:
contents: read
jobs:
CI-CD:
runs-on: ubuntu-latest
steps:
# JDK setting
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set environment variables
run: |
cd ./src/main/resources
touch ./application-secret.properties
echo "${{ secrets.ENV }}" > ./application-secret.properties
# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# docker login
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# build gradle
- name: Build gradlew
run: |
chmod +x gradlew
./gradlew jib \
-Djib.from.auth.username=${{ secrets.DOCKER_USERNAME }} \
-Djib.from.auth.password=${{ secrets.DOCKER_PASSWORD }} \
-Dspring.profiles.active=prod
## deploy to production
- name: Deploy to prod
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_PUBLIC_IP }}
username: ${{ secrets.AWS_USER }}
key: ${{ secrets.AWS_PRIVATE_KEY }}
port: ${{ secrets.AWS_SSH_PORT }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/server
sudo docker-compose up -d --no-deps --force-recreate stumeet-server
sudo docker image prune -f