fix: extensionless imports so Turbopack builds the i18n strings subpa… #238
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 & Push Docker Images | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_PREFIX: ghcr.io/medformatik/openmapx | |
| jobs: | |
| changes: | |
| name: Detect changed apps | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| apps: ${{ steps.set.outputs.apps }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - id: filter | |
| if: github.event_name != 'workflow_dispatch' | |
| uses: dorny/paths-filter@v4 | |
| with: | |
| filters: | | |
| api: | |
| - 'apps/api/**' | |
| - 'packages/**' | |
| - 'integrations/**' | |
| - 'pnpm-lock.yaml' | |
| - 'pnpm-workspace.yaml' | |
| - 'package.json' | |
| - 'apps/api/Dockerfile' | |
| web: | |
| - 'apps/web/**' | |
| - 'packages/**' | |
| - 'integrations/**' | |
| - 'pnpm-lock.yaml' | |
| - 'pnpm-workspace.yaml' | |
| - 'package.json' | |
| - 'apps/web/Dockerfile' | |
| data-manager: | |
| - 'services/data-manager/**' | |
| - 'packages/**' | |
| - 'pnpm-lock.yaml' | |
| - 'pnpm-workspace.yaml' | |
| - 'package.json' | |
| transitous-tools: | |
| - 'services/motis/tools/transitous/**' | |
| - id: set | |
| env: | |
| DISPATCH: ${{ github.event_name == 'workflow_dispatch' }} | |
| FILTER_CHANGES: ${{ steps.filter.outputs.changes }} | |
| run: | | |
| if [ "$DISPATCH" = "true" ]; then | |
| echo 'apps=["api","web","data-manager","transitous-tools"]' >> "$GITHUB_OUTPUT" | |
| else | |
| echo "apps=${FILTER_CHANGES}" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| name: Build ${{ matrix.app }} | |
| needs: changes | |
| if: needs.changes.outputs.apps != '[]' && needs.changes.outputs.apps != '' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| security-events: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| app: ${{ fromJSON(needs.changes.outputs.apps) }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Resolve build context | |
| id: ctx | |
| env: | |
| APP: ${{ matrix.app }} | |
| run: | | |
| case "$APP" in | |
| api) | |
| echo "context=." >> "$GITHUB_OUTPUT" | |
| echo "dockerfile=apps/api/Dockerfile" >> "$GITHUB_OUTPUT" | |
| ;; | |
| web) | |
| echo "context=." >> "$GITHUB_OUTPUT" | |
| echo "dockerfile=apps/web/Dockerfile" >> "$GITHUB_OUTPUT" | |
| ;; | |
| data-manager) | |
| echo "context=." >> "$GITHUB_OUTPUT" | |
| echo "dockerfile=services/data-manager/Dockerfile" >> "$GITHUB_OUTPUT" | |
| ;; | |
| transitous-tools) | |
| echo "context=services/motis/tools/transitous" >> "$GITHUB_OUTPUT" | |
| echo "dockerfile=services/motis/tools/transitous/Dockerfile" >> "$GITHUB_OUTPUT" | |
| ;; | |
| *) | |
| echo "Unknown app: $APP" >&2 | |
| exit 1 | |
| ;; | |
| esac | |
| - uses: docker/setup-buildx-action@v4 | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/metadata-action@v6 | |
| id: meta | |
| with: | |
| images: ${{ env.IMAGE_PREFIX }}-${{ matrix.app }} | |
| tags: | | |
| type=sha,prefix= | |
| type=raw,value=latest | |
| - uses: docker/build-push-action@v7 | |
| id: build | |
| with: | |
| context: ${{ steps.ctx.outputs.context }} | |
| file: ${{ steps.ctx.outputs.dockerfile }} | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=${{ matrix.app }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.app }} | |
| provenance: mode=max | |
| sbom: true | |
| # Trivy scan + SARIF upload require Code Scanning, which needs | |
| # GitHub Advanced Security on private repos. To enable: make the | |
| # repo public OR set repo variable ENABLE_CODE_SCANNING=true | |
| # under Settings → Secrets and variables → Actions → Variables. | |
| - name: Scan image with Trivy | |
| if: vars.ENABLE_CODE_SCANNING == 'true' | |
| uses: aquasecurity/trivy-action@v0.36.0 | |
| with: | |
| image-ref: ${{ env.IMAGE_PREFIX }}-${{ matrix.app }}@${{ steps.build.outputs.digest }} | |
| format: sarif | |
| output: trivy-${{ matrix.app }}.sarif | |
| severity: CRITICAL,HIGH | |
| ignore-unfixed: true | |
| exit-code: "0" | |
| - name: Upload Trivy results | |
| if: always() && vars.ENABLE_CODE_SCANNING == 'true' | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: trivy-${{ matrix.app }}.sarif | |
| category: trivy-${{ matrix.app }} |