|
| 1 | +name: Build Docker Images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | +jobs: |
| 7 | + test: |
| 8 | + name: Run Java Tests |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Checkout |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - uses: actions/setup-java@v4 |
| 15 | + with: |
| 16 | + java-version: "21" |
| 17 | + distribution: "temurin" |
| 18 | + |
| 19 | + - name: Setup Gradle |
| 20 | + uses: gradle/actions/setup-gradle@v4 |
| 21 | + |
| 22 | + - name: Build with Gradle |
| 23 | + run: cd server && ./gradlew build |
| 24 | + |
| 25 | + build: |
| 26 | + name: Build and Push Docker Images |
| 27 | + needs: test |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + |
| 35 | + - name: Log in to the Container registry |
| 36 | + uses: docker/login-action@v3 |
| 37 | + with: |
| 38 | + registry: ghcr.io |
| 39 | + username: ${{ github.actor }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - name: Set up QEMU |
| 43 | + uses: docker/setup-qemu-action@v3 |
| 44 | + with: |
| 45 | + platforms: all |
| 46 | + |
| 47 | + - name: Install Docker Buildx |
| 48 | + id: buildx |
| 49 | + uses: docker/setup-buildx-action@v3 |
| 50 | + |
| 51 | + - name: Extract metadata (tags, labels) for Docker |
| 52 | + id: meta |
| 53 | + uses: docker/metadata-action@v5 |
| 54 | + with: |
| 55 | + images: ghcr.io/${{ github.repository }} |
| 56 | + tags: | |
| 57 | + type=raw,value=latest,enable={{is_default_branch}} |
| 58 | + type=ref,event=branch |
| 59 | + type=ref,event=pr |
| 60 | +
|
| 61 | + - name: Build and push Docker Images |
| 62 | + uses: docker/build-push-action@v5 |
| 63 | + with: |
| 64 | + platforms: linux/amd64,linux/arm64 |
| 65 | + context: . |
| 66 | + file: deployment/compose.yml |
| 67 | + push: true |
| 68 | + tags: ${{ steps.meta.outputs.tags }} |
| 69 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments