fix: JWT 검증 부분 주석 해제 #28
This file contains hidden or 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 cd | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DOCKER_IMAGE_REPO: ${{ secrets.DOCKER_IMAGE_REPO }} # ex) hyuneun/crame | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: temurin | |
| - name: Build (skip tests) | |
| run: ./gradlew build -x test | |
| - name: Docker login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Build & Push image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/arm64 | |
| tags: | | |
| ${{ env.DOCKER_IMAGE_REPO }}:${{ github.ref_name }} | |
| ${{ env.DOCKER_IMAGE_REPO }}:${{ github.sha }} | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy on server | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.SSH_KEY }} | |
| script: | | |
| set -e | |
| cd /home/ubuntu/crame | |
| [ -f .env ] || touch .env | |
| # DOCKER_IMAGE_REPO 업데이트 | |
| if grep -q '^DOCKER_IMAGE_REPO=' .env; then | |
| sed -i "s|^DOCKER_IMAGE_REPO=.*|DOCKER_IMAGE_REPO=${{ env.DOCKER_IMAGE_REPO }}|" .env | |
| else | |
| echo "DOCKER_IMAGE_REPO=${{ env.DOCKER_IMAGE_REPO }}" >> .env | |
| fi | |
| # 브랜치명(main/dev)으로 태그 업데이트 | |
| if grep -q '^DOCKER_IMAGE_TAG=' .env; then | |
| sed -i "s|^DOCKER_IMAGE_TAG=.*|DOCKER_IMAGE_TAG=${{ github.ref_name }}|" .env | |
| else | |
| echo "DOCKER_IMAGE_TAG=${{ github.ref_name }}" >> .env | |
| fi | |
| docker compose pull | |
| docker compose up -d | |
| docker image prune -f |