Repository navigation
Release v2.0.0: Security & License Scanning #123
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: Build and Publish Multi-Architecture Docker Image | |
| on: | |
| push: | |
| branches: [main, develop] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| DOCKER_HUB_REPOSITORY: arvindand/maven-tools-mcp | |
| jobs: | |
| build-amd64: | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "24" | |
| distribution: "temurin" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-amd64-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-amd64-m2 | |
| - name: Make mvnw executable | |
| run: chmod +x ./mvnw | |
| - name: Build with Maven | |
| run: ./mvnw clean package -DskipTests | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build and push AMD64 images (with and without Context7) | |
| run: | | |
| PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null || echo "2.0.0") | |
| # Build AMD64 native image WITH Context7 | |
| SPRING_PROFILES_ACTIVE=docker ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=arvindand/maven-tools-mcp:${PROJECT_VERSION}-amd64 \ | |
| -Dspring-boot.build-image.env.BP_NATIVE_IMAGE_BUILD_ARGUMENTS="-march=x86-64-v2 --no-fallback" \ | |
| -Dspring-boot.build-image.createdDate=now \ | |
| -Dspring-boot.build-image.publish=true \ | |
| -Ddocker.publishRegistry.username="${{ secrets.DOCKER_HUB_USERNAME }}" \ | |
| -Ddocker.publishRegistry.password="${{ secrets.DOCKER_HUB_TOKEN }}" | |
| # Build AMD64 native image WITHOUT Context7 (noc7 variant) | |
| SPRING_PROFILES_ACTIVE=docker,no-context7 ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-amd64 \ | |
| -Dspring-boot.build-image.env.BP_NATIVE_IMAGE_BUILD_ARGUMENTS="-march=x86-64-v2 --no-fallback" \ | |
| -Dspring-boot.build-image.createdDate=now \ | |
| -Dspring-boot.build-image.publish=true \ | |
| -Ddocker.publishRegistry.username="${{ secrets.DOCKER_HUB_USERNAME }}" \ | |
| -Ddocker.publishRegistry.password="${{ secrets.DOCKER_HUB_TOKEN }}" | |
| build-arm64: | |
| runs-on: ubuntu-24.04-arm # Free ARM64 runners for public repos | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "24" | |
| distribution: "temurin" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-arm64-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-arm64-m2 | |
| - name: Make mvnw executable | |
| run: chmod +x ./mvnw | |
| - name: Build with Maven | |
| run: ./mvnw clean package -DskipTests | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build and push ARM64 images (with and without Context7) | |
| run: | | |
| PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null || echo "2.0.0") | |
| # Build ARM64 native image WITH Context7 | |
| SPRING_PROFILES_ACTIVE=docker ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=arvindand/maven-tools-mcp:${PROJECT_VERSION}-arm64 \ | |
| -Dspring-boot.build-image.createdDate=now \ | |
| -Dspring-boot.build-image.publish=true \ | |
| -Ddocker.publishRegistry.username="${{ secrets.DOCKER_HUB_USERNAME }}" \ | |
| -Ddocker.publishRegistry.password="${{ secrets.DOCKER_HUB_TOKEN }}" | |
| # Build ARM64 native image WITHOUT Context7 (noc7 variant) | |
| SPRING_PROFILES_ACTIVE=docker,no-context7 ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-arm64 \ | |
| -Dspring-boot.build-image.createdDate=now \ | |
| -Dspring-boot.build-image.publish=true \ | |
| -Ddocker.publishRegistry.username="${{ secrets.DOCKER_HUB_USERNAME }}" \ | |
| -Ddocker.publishRegistry.password="${{ secrets.DOCKER_HUB_TOKEN }}" | |
| create-manifest: | |
| runs-on: ubuntu-latest | |
| needs: [build-amd64, build-arm64] | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Make mvnw executable | |
| run: chmod +x ./mvnw | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Create and push multi-architecture manifests | |
| run: | | |
| PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout 2>/dev/null || echo "2.0.0") | |
| # Create multi-architecture manifest for version tag (WITH Context7) | |
| docker manifest create arvindand/maven-tools-mcp:${PROJECT_VERSION} \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-amd64 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-arm64 | |
| docker manifest push arvindand/maven-tools-mcp:${PROJECT_VERSION} | |
| # Create multi-architecture manifest for latest tag (WITH Context7) | |
| docker manifest create arvindand/maven-tools-mcp:latest \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-amd64 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-arm64 | |
| docker manifest push arvindand/maven-tools-mcp:latest | |
| # Create multi-architecture manifest for noc7 version tag (WITHOUT Context7) | |
| docker manifest create arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-amd64 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-arm64 | |
| docker manifest push arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7 | |
| # Create multi-architecture manifest for latest-noc7 tag (WITHOUT Context7) | |
| docker manifest create arvindand/maven-tools-mcp:latest-noc7 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-amd64 \ | |
| --amend arvindand/maven-tools-mcp:${PROJECT_VERSION}-noc7-arm64 | |
| docker manifest push arvindand/maven-tools-mcp:latest-noc7 | |
| test-pr: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 24 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "24" | |
| distribution: "temurin" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Make mvnw executable | |
| run: chmod +x ./mvnw | |
| - name: Build and test PR | |
| run: | | |
| ./mvnw clean package -DskipTests | |
| # Build with Context7 (default) | |
| SPRING_PROFILES_ACTIVE=docker ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=maven-tools-mcp:pr-${{ github.event.number }} \ | |
| -Dspring-boot.build-image.createdDate=now | |
| # Build without Context7 (noc7 variant) | |
| SPRING_PROFILES_ACTIVE=docker,no-context7 ./mvnw -Pnative spring-boot:build-image \ | |
| -Dspring-boot.build-image.imageName=maven-tools-mcp:pr-${{ github.event.number }}-noc7 \ | |
| -Dspring-boot.build-image.createdDate=now | |
| # Test both images | |
| echo "Testing image with Context7..." | |
| timeout 30s docker run --rm maven-tools-mcp:pr-${{ github.event.number }} --help || true | |
| echo "Testing image without Context7..." | |
| timeout 30s docker run --rm maven-tools-mcp:pr-${{ github.event.number }}-noc7 --help || true |