mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Compare commits
7 commits
b5795a8b3f
...
a90b788138
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a90b788138 | ||
|
|
dd6556968c | ||
|
|
04a05bbf26 | ||
|
|
437c9603db | ||
|
|
03ed5349f4 | ||
|
|
4272bb4c4d | ||
|
|
6135ef9dd2 |
3 changed files with 38 additions and 17 deletions
37
.github/workflows/cd.yml
vendored
37
.github/workflows/cd.yml
vendored
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue