mirror of
https://github.com/umami-software/umami.git
synced 2026-02-23 05:55:35 +01:00
Compare commits
No commits in common. "d23ad5f2721f0aef1013e8795d8b9ef491bb8b97" and "03adb6b7e1b5ea0139f3c4e3b961058d56cf26d5" have entirely different histories.
d23ad5f272
...
03adb6b7e1
6 changed files with 34 additions and 66 deletions
37
.github/workflows/cd.yml
vendored
37
.github/workflows/cd.yml
vendored
|
|
@ -2,8 +2,17 @@ name: Create docker images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches:
|
||||||
- 'v*.*.*'
|
- master
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
# Publish semver tags as releases.
|
||||||
|
tags: [ 'v*.*.*' ]
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
@ -13,6 +22,8 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
# This is used to complete the identity challenge
|
||||||
|
# with sigstore/fulcio when running outside of PRs.
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -22,22 +33,25 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
# Install cosign (for image signing)
|
# Install the cosign tool except on PR
|
||||||
|
# https://github.com/sigstore/cosign-installer
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: sigstore/cosign-installer@v3
|
uses: sigstore/cosign-installer@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log into Docker Hub
|
- name: Log into registry docker.io
|
||||||
if: github.repository == 'umami-software/umami'
|
if: github.event_name != 'pull_request' && github.repository == 'umami-software/umami'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Log into GHCR
|
- name: Log into ghcr registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
|
@ -55,8 +69,14 @@ jobs:
|
||||||
latest=auto
|
latest=auto
|
||||||
prefix=${{ matrix.db-type }}-
|
prefix=${{ matrix.db-type }}-
|
||||||
tags: |
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
|
||||||
|
# output 1.1.2
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
# output 1.1
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
# output 1
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
|
@ -66,14 +86,15 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
build-args: DATABASE_TYPE=${{ matrix.db-type }}
|
build-args: DATABASE_TYPE=${{ matrix.db-type }}
|
||||||
push: true
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
# Sign the published image digest
|
# Sign the resulting Docker image digest except on PRs.
|
||||||
- name: Sign the published Docker image
|
- name: Sign the published Docker image
|
||||||
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
env:
|
env:
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
TAGS: ${{ steps.meta.outputs.tags }}
|
||||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
||||||
|
|
|
||||||
22
.github/workflows/delete-untagged-images.yml
vendored
22
.github/workflows/delete-untagged-images.yml
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
name: Delete untagged GHCR images
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # Run manually from the Actions tab
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
cleanup:
|
|
||||||
name: Delete all untagged images
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Delete untagged GHCR images
|
|
||||||
uses: actions/delete-package-versions@v5
|
|
||||||
with:
|
|
||||||
package-name: "umami" # 👈 change if your GHCR package name differs
|
|
||||||
package-type: "container"
|
|
||||||
delete-only-untagged-versions: true
|
|
||||||
min-versions-to-keep: 0
|
|
||||||
|
|
@ -149,21 +149,6 @@ describe('Website API tests', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Updates a website with only shareId.', () => {
|
|
||||||
cy.request({
|
|
||||||
method: 'POST',
|
|
||||||
url: `/api/websites/${websiteId}`,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
Authorization: Cypress.env('authorization'),
|
|
||||||
},
|
|
||||||
body: { shareId: 'ABCDEF' },
|
|
||||||
}).then(response => {
|
|
||||||
expect(response.status).to.eq(200);
|
|
||||||
expect(response.body).to.have.property('shareId', 'ABCDEF');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Resets a website by removing all data related to the website.', () => {
|
it('Resets a website by removing all data related to the website.', () => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
|
|
@ -103,18 +103,9 @@ export const DATE_FORMATS = {
|
||||||
year: 'yyyy',
|
year: 'yyyy',
|
||||||
};
|
};
|
||||||
|
|
||||||
const TIMEZONE_MAPPINGS: Record<string, string> = {
|
|
||||||
'Asia/Calcutta': 'Asia/Kolkata',
|
|
||||||
};
|
|
||||||
|
|
||||||
export function normalizeTimezone(timezone: string): string {
|
|
||||||
return TIMEZONE_MAPPINGS[timezone] || timezone;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isValidTimezone(timezone: string) {
|
export function isValidTimezone(timezone: string) {
|
||||||
try {
|
try {
|
||||||
const normalizedTimezone = normalizeTimezone(timezone);
|
Intl.DateTimeFormat(undefined, { timeZone: timezone });
|
||||||
Intl.DateTimeFormat(undefined, { timeZone: normalizedTimezone });
|
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -277,10 +277,6 @@ function getSchema() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getClient() {
|
function getClient() {
|
||||||
if (!process.env.DATABASE_URL) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const prisma = new UmamiPrismaClient({
|
const prisma = new UmamiPrismaClient({
|
||||||
url: process.env.DATABASE_URL,
|
url: process.env.DATABASE_URL,
|
||||||
prismaClient: PrismaClient,
|
prismaClient: PrismaClient,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { isValidTimezone, normalizeTimezone } from '@/lib/date';
|
import { isValidTimezone } from '@/lib/date';
|
||||||
import { UNIT_TYPES } from './constants';
|
import { UNIT_TYPES } from './constants';
|
||||||
|
|
||||||
export const timezoneParam = z
|
export const timezoneParam = z.string().refine(value => isValidTimezone(value), {
|
||||||
.string()
|
message: 'Invalid timezone',
|
||||||
.refine((value: string) => isValidTimezone(value), {
|
});
|
||||||
message: 'Invalid timezone',
|
|
||||||
})
|
|
||||||
.transform((value: string) => normalizeTimezone(value));
|
|
||||||
|
|
||||||
export const unitParam = z.string().refine(value => UNIT_TYPES.includes(value), {
|
export const unitParam = z.string().refine(value => UNIT_TYPES.includes(value), {
|
||||||
message: 'Invalid unit',
|
message: 'Invalid unit',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue