Bump the dotnet group with 30 updates #185
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: Docker images | |
| # Monorepo-aware image builds. A `detect` job works out which images are affected by the | |
| # change (with shared deps fanning out to every backend image), then a dynamic matrix builds | |
| # only those. On PRs: build-only (channel ci). On push to main: build + push edge + sha-<short> | |
| # to GHCR, scanned (Trivy), signed (cosign) with SBOM + provenance. Semver release tags are | |
| # published by release-please.yml. The build/scan/sign logic lives in reusable publish-image.yml. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| - 'global.json' | |
| - '**/Dockerfile' | |
| - '.dockerignore' | |
| - '.github/workflows/docker.yml' | |
| - '.github/workflows/publish-image.yml' | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| - 'global.json' | |
| - '**/Dockerfile' | |
| - '.dockerignore' | |
| - '.github/workflows/docker.yml' | |
| - '.github/workflows/publish-image.yml' | |
| concurrency: | |
| group: docker-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| detect: | |
| name: Detect affected images | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: changes | |
| with: | |
| filters: | | |
| shared_backend: | |
| - 'src/SharedKernel/**' | |
| - 'src/Contracts/**' | |
| - 'src/ServiceDefaults/**' | |
| - 'Directory.Build.props' | |
| - 'Directory.Packages.props' | |
| - 'global.json' | |
| - '.dockerignore' | |
| pipeline: | |
| - '.github/workflows/docker.yml' | |
| - '.github/workflows/publish-image.yml' | |
| gateway: | |
| - 'src/Gateway/**' | |
| masterdata: | |
| - 'src/Services/MasterData/**' | |
| warehousing: | |
| - 'src/Services/Warehousing/**' | |
| logistics: | |
| - 'src/Services/Logistics/**' | |
| cdcbridge: | |
| - 'src/CdcBridge/**' | |
| identitybridge: | |
| - 'src/IdentityBridge/**' | |
| admin: | |
| - 'src/web/admin/**' | |
| terminal: | |
| - 'src/web/terminal/**' | |
| - id: set | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const f = ${{ toJSON(steps.changes.outputs) }}; | |
| const t = (k) => f[k] === 'true'; | |
| const map = { | |
| gateway: { name: 'gateway', context: '.', dockerfile: 'src/Gateway/Warehouse.Gateway/Dockerfile' }, | |
| masterdata: { name: 'masterdata-api', context: '.', dockerfile: 'src/Services/MasterData/Warehouse.MasterData.Api/Dockerfile' }, | |
| warehousing: { name: 'warehousing-api', context: '.', dockerfile: 'src/Services/Warehousing/Warehouse.Warehousing.Api/Dockerfile' }, | |
| logistics: { name: 'logistics-api', context: '.', dockerfile: 'src/Services/Logistics/Warehouse.Logistics.Api/Dockerfile' }, | |
| cdcbridge: { name: 'cdc-bridge', context: '.', dockerfile: 'src/CdcBridge/Warehouse.CdcBridge/Dockerfile' }, | |
| identitybridge: { name: 'identity-bridge', context: '.', dockerfile: 'src/IdentityBridge/Warehouse.IdentityBridge/Dockerfile' }, | |
| admin: { name: 'admin', context: 'src/web/admin', dockerfile: 'src/web/admin/Dockerfile' }, | |
| terminal: { name: 'terminal', context: 'src/web/terminal', dockerfile: 'src/web/terminal/Dockerfile' }, | |
| }; | |
| // A shared backend change (or a change to the build logic itself) rebuilds every backend image, | |
| // because the service Dockerfiles build from the repo root with the shared props. | |
| const allBackend = t('pipeline') || t('shared_backend'); | |
| const want = new Set(); | |
| for (const k of ['gateway', 'masterdata', 'warehousing', 'logistics', 'cdcbridge', 'identitybridge']) if (allBackend || t(k)) want.add(k); | |
| for (const k of ['admin', 'terminal']) if (t('pipeline') || t(k)) want.add(k); | |
| const include = [...want].map((k) => map[k]); | |
| core.info('Images to build: ' + (include.map((i) => i.name).join(', ') || '(none)')); | |
| core.setOutput('matrix', JSON.stringify({ include })); | |
| images: | |
| needs: detect | |
| if: ${{ needs.detect.outputs.matrix != '{"include":[]}' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.detect.outputs.matrix) }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| security-events: write | |
| uses: ./.github/workflows/publish-image.yml | |
| with: | |
| name: ${{ matrix.name }} | |
| context: ${{ matrix.context }} | |
| dockerfile: ${{ matrix.dockerfile }} | |
| # PRs build only; pushes to main publish the `edge` + `sha-<short>` images. | |
| channel: ${{ github.event_name == 'pull_request' && 'ci' || 'edge' }} |