🐛 fix(ci): main builds compute fresh CalVer and tag locally befor… #29
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: server-ci | |
| on: | |
| push: | |
| paths: | |
| - "server/**" | |
| - ".github/workflows/server-ci.yaml" | |
| - "core/identity/src/test/resources/identity/**" | |
| pull_request: | |
| paths: | |
| - "server/**" | |
| - ".github/workflows/server-ci.yaml" | |
| - "core/identity/src/test/resources/identity/**" | |
| # Cancel superseded runs on the same branch / PR. | |
| concurrency: | |
| group: server-ci-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: server | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install | |
| run: | | |
| uv venv | |
| uv pip install -e ".[dev]" | |
| - name: Lint | |
| run: uv run ruff check . && uv run ruff format --check . | |
| - name: Test | |
| run: uv run pytest -v | |
| image: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 | |
| with: | |
| context: server | |
| push: true | |
| sbom: true | |
| provenance: mode=max | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/opds-sync:${{ github.sha }} | |
| ghcr.io/${{ github.repository_owner }}/opds-sync:latest | |
| scan: | |
| # SARIF upload requires Code Scanning enabled, which is free on | |
| # public repos and gated behind GitHub Advanced Security on private | |
| # ones. Skip until the repo is public. | |
| needs: image | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event.repository.visibility == 'public' | |
| permissions: | |
| contents: read | |
| actions: read | |
| packages: read | |
| security-events: write | |
| steps: | |
| - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | |
| with: | |
| image-ref: ghcr.io/${{ github.repository_owner }}/opds-sync:${{ github.sha }} | |
| format: sarif | |
| output: trivy.sarif | |
| severity: HIGH,CRITICAL | |
| ignore-unfixed: true | |
| - uses: github/codeql-action/upload-sarif@0daab03d71ff584ef619d027a3fd9146679c5d84 # v3 | |
| with: | |
| sarif_file: trivy.sarif |