1+ # CI with maven build and scan
2+
3+ name : CI docker build
4+
5+ on :
6+ # Trigger analysis when pushing in master or pull requests, and when creating
7+ # a pull request.
8+ push :
9+ branches :
10+ - develop
11+ release :
12+ types : [published]
13+
14+ jobs :
15+ docker :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ # Shallow clones should be disabled for a better relevancy of analysis
21+ fetch-depth : 0
22+ - name : Echo ref name trigger
23+ run : echo ${{ github.ref_name }}
24+ - name : Set up JDK 21
25+ uses : actions/setup-java@v4
26+ with :
27+ java-version : ' 21'
28+ distribution : ' corretto'
29+ cache : ' maven'
30+ - name : Cache Maven packages
31+ uses : actions/cache@v4
32+ with :
33+ path : ~/.m2
34+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
35+ restore-keys : ${{ runner.os }}-m2
36+ - name : Cache SonarCloud packages
37+ uses : actions/cache@v1
38+ with :
39+ path : ~/.sonar/cache
40+ key : ${{ runner.os }}-sonar
41+ restore-keys : ${{ runner.os }}-sonar
42+ - name : Maven version
43+ run : mvn -v
44+ env :
45+ # Needed to get some information about the pull request, if any
46+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47+ # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
48+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
49+ - name : Build and analyze
50+ run : mvn -B clean package
51+ # using action https://github.com/marketplace/actions/build-and-push-docker-images
52+ - name : Set up QEMU
53+ uses : docker/setup-qemu-action@v3
54+ - name : Set up Docker Buildx
55+ uses : docker/setup-buildx-action@v3
56+ - name : Login to Docker Hub
57+ uses : docker/login-action@v3
58+ with :
59+ username : ${{ secrets.DOCKERHUB_USERNAME }}
60+ password : ${{ secrets.DOCKERHUB_TOKEN }}
61+ - name : Build and push
62+ uses : docker/build-push-action@v5
63+ with :
64+ context : .
65+ platforms : linux/amd64,linux/arm64
66+ push : true
67+ tags : fugeritorg/fj-daogen-quarkus-demo:${{ github.ref_name }},fugeritorg/fj-daogen-quarkus-demo:latest
0 commit comments