Compare commits

...

7 commits

Author SHA1 Message Date
Mike Cao
a90b788138 Updated cd script.
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
2025-11-07 00:09:53 -08:00
Mike Cao
dd6556968c Updated image tag. 2025-11-06 23:58:12 -08:00
Mike Cao
04a05bbf26 Added workflow input. 2025-11-06 23:35:14 -08:00
Mike Cao
437c9603db Fixed build. 2025-11-06 22:58:26 -08:00
Mike Cao
03ed5349f4 Merge branch 'dev' 2025-11-06 22:50:30 -08:00
Mike Cao
4272bb4c4d Removed db types from docker build. 2025-11-06 22:48:34 -08:00
Mike Cao
6135ef9dd2 Fixed test. 2025-11-06 22:24:08 -08:00
3 changed files with 38 additions and 17 deletions

View file

@ -5,6 +5,11 @@ on:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Optional image version (e.g. 3.0.0, beta)'
required: false
default: ''
jobs:
build:
@ -15,14 +20,9 @@ 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,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
@ -53,26 +68,32 @@ 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 }}

View file

@ -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:

View file

@ -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);
});