diff --git a/.github/workflows/cd-dev-deploy.yml b/.github/workflows/cd-dev-deploy.yml index 4a35a67..6488273 100644 --- a/.github/workflows/cd-dev-deploy.yml +++ b/.github/workflows/cd-dev-deploy.yml @@ -7,7 +7,7 @@ on: permissions: contents: read - packages: read # 배포 서버에서 pull만 하면 read면 충분 + packages: read concurrency: group: dev-deploy @@ -15,38 +15,34 @@ concurrency: env: APP_NAME: book-preprocessing-worker - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} APP_PORT: 9002 jobs: deploy: - # ✅ CI 성공 + dev 브랜치에서만 if: > ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'dev' }} runs-on: ubuntu-latest + steps: - name: Deploy to dev server uses: appleboy/ssh-action@v1.0.3 env: - # CI에서 푸시된 커밋 sha = head_sha - VERSION: dev-${{ github.event.workflow_run.head_sha }} + IMAGE_TAG: dev-${{ github.event.workflow_run.head_sha }} APP_NAME: ${{ env.APP_NAME }} + APP_PORT: ${{ env.APP_PORT }} GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} GHCR_USER: ${{ github.actor }} - APP_PORT: ${{ env.APP_PORT }} with: host: ${{ secrets.DEV_REMOTE_IP }} username: ubuntu key: ${{ secrets.DEV_REMOTE_PRIVATE_KEY }} port: ${{ secrets.DEV_REMOTE_SSH_PORT }} - envs: VERSION,APP_NAME,GHCR_TOKEN,GHCR_USER,APP_PORT + envs: IMAGE_TAG,APP_NAME,APP_PORT,GHCR_TOKEN,GHCR_USER script: | - set -euo pipefail + set -e cd /home/ubuntu/app/${APP_NAME} - echo "$GHCR_TOKEN" | sudo docker login ghcr.io -u "$GHCR_USER" --password-stdin - chmod +x deploy.sh - ./deploy.sh + echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USER" --password-stdin + ./deploy.sh \ No newline at end of file diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 7a29d8b..d91b673 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -43,8 +43,4 @@ jobs: uses: mikepenz/action-junit-report@v4 if: always() with: - report_paths: '**/build/test-results/test/*.xml' - - - - + report_paths: '**/build/test-results/test/*.xml' \ No newline at end of file