[feat] 카테고리로 질문 리스트 조회 API 추가 / RestDocs 문서 추가 (#93) #49
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: BE - CD | |
on: | |
push: | |
branches: [main] | |
paths: | |
[ | |
"src/**", | |
"build.gradle", | |
] | |
permissions: | |
contents: read | |
jobs: | |
be-test: | |
name: test spring boot | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: setup repo | |
uses: actions/checkout@v3 | |
- name: setup java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: gradle | |
- name: Insert Database Information | |
run: | | |
sed -i "s|\${MYSQL_URL}|$MYSQL_URL|g" ./src/main/resources/application-db.yml | |
sed -i "s|\${MYSQL_USERNAME}|$MYSQL_USERNAME|g" ./src/main/resources/application-db.yml | |
sed -i "s|\${MYSQL_PASSWORD}|$MYSQL_PASSWORD|g" ./src/main/resources/application-db.yml | |
sed -i "s|\${CLIENT_ORIGIN}|$CLIENT_ORIGIN|g" ./src/main/resources/application-cors.yml | |
env: | |
MYSQL_URL: ${{ secrets.MYSQL_URL }} | |
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME }} | |
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} | |
CLIENT_ORIGIN: ${{ secrets.CLIENT_ORIGIN }} | |
- name: use gradle cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: build with gradle | |
run: ./gradlew build | |
- name: docker build & push | |
run: | | |
docker login -u "${{ secrets.DOCKER_ID }}" -p "${{ secrets.DOCKER_PASSWORD }}" | |
docker build -f Dockerfile -t "${{ secrets.DOCKER_REPO }}"/kkeuroolryo . | |
docker push "${{ secrets.DOCKER_REPO }}"/kkeuroolryo | |
- name: run remote ssh command plugin | |
uses: appleboy/[email protected] | |
id: deploy-prod | |
with: | |
host: "${{ secrets.EC2_HOST }}" | |
username: "${{ secrets.EC2_USERNAME }}" | |
key: "${{ secrets.EC2_PRIVATE_KEY }}" | |
envs: GITHUB_SHA | |
script: | | |
docker stop kkeuroolryo | |
docker rm kkeuroolryo | |
sudo docker pull "${{ secrets.DOCKER_REPO }}"/kkeuroolryo | |
docker run -d --name kkeuroolryo -p 8080:8080 "${{ secrets.DOCKER_REPO }}"/kkeuroolryo | |
docker rmi -f $(docker images -f "dangling=true" -q) |