This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Security #5
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: Security | |
| on: | |
| schedule: | |
| - cron: '0 5 * * 1-5' | |
| workflow_dispatch: | |
| jobs: | |
| scan-code: | |
| name: Scan code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trivy source code | |
| id: trivy_source_code | |
| uses: aquasecurity/[email protected] | |
| with: | |
| scan-type: fs | |
| scan-ref: . | |
| scanners: vuln | |
| severity: CRITICAL,HIGH | |
| format: sarif | |
| output: trivy-results.sarif | |
| ignore-unfixed: true | |
| limit-severities-for-sarif: true | |
| - name: Upload Trivy source code report | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: trivy-results.sarif | |
| category: source-code | |
| scan-docker: | |
| name: Scan Docker ${{ matrix.platform }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| platform: [ 'linux/amd64', 'linux/arm64' ] | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build | |
| run: mvn clean package -DskipTests | |
| - name: Metadata | |
| id: metadata | |
| run: | | |
| platform_slug=$(echo ${{ matrix.platform }} | sed 's/\//-/g') | |
| echo platform_slug=$platform_slug >> $GITHUB_OUTPUT | |
| echo image_name=loicgreffier/docsource:$platform_slug-jar >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: .docker/Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: false | |
| load: true | |
| tags: ${{ steps.metadata.outputs.image_name }} | |
| env: | |
| DOCKER_BUILD_SUMMARY: false | |
| - name: Trivy Docker image | |
| uses: aquasecurity/[email protected] | |
| with: | |
| scan-type: image | |
| image-ref: ${{ steps.metadata.outputs.image_name }} | |
| scanners: vuln | |
| severity: CRITICAL,HIGH | |
| format: sarif | |
| output: trivy-results.sarif | |
| ignore-unfixed: true | |
| limit-severities-for-sarif: true | |
| - name: Upload Trivy Docker image report | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: trivy-results.sarif | |
| category: docker-image-${{ steps.metadata.outputs.platform_slug }} |