feat: 게시글 도메인 추가 #19
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: Dev - CI (Build & Push) | |
| on: | |
| push: | |
| branches: [ "dev" ] | |
| pull_request: | |
| branches: [ "dev" ] | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| outputs: | |
| image-tag: ${{ steps.meta.outputs.tags }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.ACTION_TOKEN }} | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Add +x permission to gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew clean build | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v5 | |
| if: success() || failure() | |
| with: | |
| report_paths: '**/build/test-results/test/TEST-*.xml' | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: docker-container | |
| driver-opts: network=host | |
| - name: Login to Github Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.ACTION_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=sha | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # [필수 추가] 분리된 CD 파일로 태그 정보를 넘겨주기 위해 파일로 저장 | |
| - name: Export Image Tag | |
| run: echo "${{ steps.meta.outputs.tags }}" > image_tag.txt | |
| - name: Upload Image Tag Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: image-tag | |
| path: image_tag.txt |