diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3098d314b..a02e9900c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,11 +5,6 @@ on: tags: - 'v*.*.*' workflow_dispatch: - inputs: - version: - description: 'Optional image version (e.g. 3.0.0, beta)' - required: false - default: '' jobs: build: @@ -20,9 +15,14 @@ jobs: packages: write id-token: write + strategy: + matrix: + db-type: [postgresql] + steps: - uses: actions/checkout@v5 + # Install cosign (for image signing) - name: Install cosign uses: sigstore/cosign-installer@v3 @@ -44,21 +44,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Normalize manual input if provided - - name: Normalize manual version - id: normalize - run: | - INPUT="${{ github.event.inputs.version }}" - if [[ -n "$INPUT" ]]; then - # Strip leading v if present - VERSION="${INPUT#v}" - MAJOR=$(echo "$VERSION" | cut -d. -f1) - MINOR=$(echo "$VERSION" | cut -d. -f2) - echo "version_tags=${VERSION},${MAJOR}.${MINOR},${MAJOR}" >> $GITHUB_ENV - else - echo "version_tags=" >> $GITHUB_ENV - fi - - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 @@ -68,32 +53,26 @@ jobs: ghcr.io/${{ github.repository }} flavor: | latest=auto + prefix=${{ matrix.db-type }}- tags: | - # Semver tags from real Git tags type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - # Manual input derived tags - type=raw,value=${{ env.version_tags }},enable=${{ env.version_tags != '' }} - - # Fallbacks for branches/PRs - type=ref,event=branch - type=ref,event=pr - type=sha - - name: Build and push Docker image id: build-and-push uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 + build-args: DATABASE_TYPE=${{ matrix.db-type }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + # Sign the published image digest - name: Sign the published Docker image env: TAGS: ${{ steps.meta.outputs.tags }} diff --git a/docker-compose.yml b/docker-compose.yml index 8c8a47a6e..7b51db66c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ --- services: umami: - image: ghcr.io/umami-software/umami:latest + image: ghcr.io/umami-software/umami:postgresql-latest ports: - "3000:3000" environment: diff --git a/src/lib/__tests__/detect.test.ts b/src/lib/__tests__/detect.test.ts index f02ac8392..fcf706af1 100644 --- a/src/lib/__tests__/detect.test.ts +++ b/src/lib/__tests__/detect.test.ts @@ -1,4 +1,4 @@ -import { getIpAddress } from '../ip'; +import * as detect from '../detect'; const IP = '127.0.0.1'; const BAD_IP = '127.127.127.127'; @@ -6,23 +6,23 @@ const BAD_IP = '127.127.127.127'; test('getIpAddress: Custom header', () => { process.env.CLIENT_IP_HEADER = 'x-custom-ip-header'; - expect(getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP); + expect(detect.getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP); }); test('getIpAddress: CloudFlare header', () => { - expect(getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP); + expect(detect.getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP); }); test('getIpAddress: Standard header', () => { - expect(getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP); + expect(detect.getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP); }); test('getIpAddress: CloudFlare header is lower priority than standard header', () => { - expect(getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP }))).toEqual( - IP, - ); + expect( + detect.getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP })), + ).toEqual(IP); }); test('getIpAddress: No header', () => { - expect(getIpAddress(new Headers())).toEqual(null); + expect(detect.getIpAddress(new Headers())).toEqual(null); });