name: Build & Push Native Image on: push: branches: - main workflow_dispatch: jobs: check-actor: runs-on: ubuntu-latest outputs: allowed: ${{ steps.check.outputs.allowed }} steps: - id: check run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" || "${{ github.actor }}" == "TeamCity" ]]; then echo "allowed=true" >> "$GITHUB_OUTPUT" else echo "allowed=false" >> "$GITHUB_OUTPUT" fi build-and-push: needs: check-actor if: needs.check-actor.outputs.allowed == 'true' runs-on: ubuntu-latest permissions: contents: read packages: write strategy: matrix: module: - account - bot-platform - coordinator - core - io - official-bots - rule - store - ws steps: - uses: actions/checkout@v4 - name: Set up GraalVM uses: graalvm/setup-graalvm@v1 with: java-version: '21' distribution: 'graalvm-community' native-image-job-reports: 'true' - name: Cache Gradle packages uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} restore-keys: gradle-${{ runner.os }}- - name: Build native binary run: ./gradlew :modules:${{ matrix.module }}:build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false --no-daemon - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/now-chess/now-chess-systems/${{ matrix.module }} tags: | type=sha,prefix=,format=short type=raw,value=latest - name: Build and push uses: docker/build-push-action@v6 with: context: . file: modules/${{ matrix.module }}/src/main/docker/Dockerfile.native push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=${{ matrix.module }} cache-to: type=gha,mode=max,scope=${{ matrix.module }}