From 6135ef9dd218186ed663f89a511fa66bfecc6aec Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 6 Nov 2025 22:24:08 -0800 Subject: [PATCH 1/6] Fixed test. --- src/lib/__tests__/detect.test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/__tests__/detect.test.ts b/src/lib/__tests__/detect.test.ts index fcf706af..f02ac839 100644 --- a/src/lib/__tests__/detect.test.ts +++ b/src/lib/__tests__/detect.test.ts @@ -1,4 +1,4 @@ -import * as detect from '../detect'; +import { getIpAddress } from '../ip'; 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(detect.getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP); + expect(getIpAddress(new Headers({ 'x-custom-ip-header': IP }))).toEqual(IP); }); test('getIpAddress: CloudFlare header', () => { - expect(detect.getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP); + expect(getIpAddress(new Headers({ 'cf-connecting-ip': IP }))).toEqual(IP); }); test('getIpAddress: Standard header', () => { - expect(detect.getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP); + expect(getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP); }); test('getIpAddress: CloudFlare header is lower priority than standard header', () => { - expect( - detect.getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP })), - ).toEqual(IP); + expect(getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP }))).toEqual( + IP, + ); }); test('getIpAddress: No header', () => { - expect(detect.getIpAddress(new Headers())).toEqual(null); + expect(getIpAddress(new Headers())).toEqual(null); }); From 4272bb4c4d44aec362ecf0e1c16be61c5f053525 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 6 Nov 2025 22:48:34 -0800 Subject: [PATCH 2/6] Removed db types from docker build. --- .github/workflows/cd.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a02e9900..1b9e8965 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -15,10 +15,6 @@ jobs: packages: write id-token: write - strategy: - matrix: - db-type: [postgresql] - steps: - uses: actions/checkout@v5 @@ -53,7 +49,6 @@ jobs: ghcr.io/${{ github.repository }} flavor: | latest=auto - prefix=${{ matrix.db-type }}- tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} @@ -65,7 +60,6 @@ jobs: 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 }} From 437c9603dbf9e2362c3a19fd4c5952592867708f Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 6 Nov 2025 22:58:26 -0800 Subject: [PATCH 3/6] Fixed build. --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1b9e8965..d3ee4ee2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -53,6 +53,9 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} + type=ref,event=branch + type=ref,event=pr + type=sha - name: Build and push Docker image id: build-and-push From 04a05bbf26b0855441b9c2cc4cfa1a4ad49efa9b Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 6 Nov 2025 23:35:14 -0800 Subject: [PATCH 4/6] Added workflow input. --- .github/workflows/cd.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d3ee4ee2..1e070a7c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,6 +5,11 @@ on: tags: - 'v*.*.*' workflow_dispatch: + inputs: + manual_tag: + description: 'Optional image tag (e.g. 1.2.3, beta, nightly)' + required: false + default: '' jobs: build: @@ -54,8 +59,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=ref,event=branch - type=ref,event=pr - type=sha + type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} - name: Build and push Docker image id: build-and-push From dd6556968cfbf8d05b18e7e93e2f37963015958a Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 6 Nov 2025 23:58:12 -0800 Subject: [PATCH 5/6] Updated image tag. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7b51db66..8c8a47a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ --- services: umami: - image: ghcr.io/umami-software/umami:postgresql-latest + image: ghcr.io/umami-software/umami:latest ports: - "3000:3000" environment: From a90b7881387ac54d745fd8c11325e312c0fcc0d8 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 7 Nov 2025 00:09:53 -0800 Subject: [PATCH 6/6] Updated cd script. --- .github/workflows/cd.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1e070a7c..3098d314 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,8 +6,8 @@ on: - 'v*.*.*' workflow_dispatch: inputs: - manual_tag: - description: 'Optional image tag (e.g. 1.2.3, beta, nightly)' + version: + description: 'Optional image version (e.g. 3.0.0, beta)' required: false default: '' @@ -23,7 +23,6 @@ jobs: steps: - uses: actions/checkout@v5 - # Install cosign (for image signing) - name: Install cosign uses: sigstore/cosign-installer@v3 @@ -45,6 +44,21 @@ 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 @@ -55,11 +69,18 @@ jobs: flavor: | latest=auto 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=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }} + type=ref,event=pr + type=sha - name: Build and push Docker image id: build-and-push @@ -73,7 +94,6 @@ jobs: 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 }}