fix: resolve CredentialMasker regex group reference bugs #1
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 Docker Images | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Log in to Quay.io | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Extract metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| docker.io/flossware/platform-java | |
| ghcr.io/${{ github.repository }} | |
| quay.io/flossware/platform-java | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix={{branch}}- | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=main,enable={{is_default_branch}} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: ${{ github.event_name == 'push' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build Alpine variant (if on main) | |
| if: github.ref == 'refs/heads/main' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.alpine | |
| push: ${{ github.event_name == 'push' }} | |
| tags: | | |
| docker.io/flossware/platform-java:latest-alpine | |
| ghcr.io/${{ github.repository }}:latest-alpine | |
| quay.io/flossware/platform-java:latest-alpine | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| test-docker-image: | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build test image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| load: true | |
| tags: platform-java:test | |
| cache-from: type=gha | |
| - name: Test Docker image | |
| run: | | |
| docker run --rm -d \ | |
| --name platform-java-test \ | |
| -p 8080:8080 \ | |
| -e JAVA_OPTS="-Xms256m -Xmx512m" \ | |
| platform-java:test \ | |
| --rest-api --port 8080 | |
| # Wait for platform to start | |
| sleep 10 | |
| # Check if REST API is responding | |
| curl -f http://localhost:8080/api/health || exit 1 | |
| # Check if web console is available | |
| curl -f http://localhost:8080/console || exit 1 | |
| # Stop container | |
| docker stop platform-java-test | |
| - name: Show Docker image size | |
| run: | | |
| docker images platform-java:test --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" |