[BE] 삭제하기 위한 쿠키에 도메인 정보를 추가한다. #72
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: backend-dev-cd | |
on: | |
pull_request: | |
branches: [ "dev" ] | |
types: [closed] | |
jobs: | |
build: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-version: 8.8 | |
- name: Grant execute permission for gradlew | |
run: chmod +x backend/bang-ggood/gradlew | |
- name: Write application.yml | |
env: | |
APPLICATION_YML: ${{ secrets.APPLICATION_YML }} | |
APPLICATION_DEV_YML: ${{ secrets.APPLICATION_DEV_YML }} | |
APPLICATION_TEST_YML: ${{ secrets.APPLICATION_TEST_YML }} | |
APPLICATION_READ_WRITE_TEST_YML: ${{ secrets.APPLICATION_READ_WRITE_TEST_YML }} | |
run: | | |
echo "${APPLICATION_YML}" > backend/bang-ggood/src/main/resources/application.yml | |
echo "${APPLICATION_DEV_YML}" > backend/bang-ggood/src/main/resources/application-dev.yml | |
echo "${APPLICATION_TEST_YML}" > backend/bang-ggood/src/test/resources/application-test.yml | |
echo "${APPLICATION_READ_WRITE_TEST_YML}" > backend/bang-ggood/src/test/resources/application-read-write-test.yml | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
working-directory: backend/bang-ggood | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
working-directory: backend/bang-ggood | |
name: bang-ggood-be-develop-jar | |
path: ./**/*.jar | |
deploy: | |
needs: build | |
runs-on: bang-ggood-dev | |
steps: | |
- name: change permission | |
run: sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/2024-bang-ggood | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: bang-ggood-be-develop-jar | |
- name: Create unhealth_flag file | |
run: echo "unhealth" | sudo tee /etc/nginx/sites-available/unhealth_flag.txt > /dev/null | |
- name: Sleep for 30 seconds | |
run: sleep 30 | |
- name: Turn off the server 8080 if runs | |
run: sudo fuser -k -n tcp 8080 || true | |
- name: Start server | |
run: sudo nohup java -jar -Dspring.profiles.active=dev -Duser.timezone=Asia/Seoul ./backend/bang-ggood/build/libs/*SNAPSHOT.jar > /home/ubuntu/actions-runner/server.log 2>&1 & | |
- name: Delete unhealth_flag file | |
run: sudo rm /etc/nginx/sites-available/unhealth_flag.txt |