mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
89 lines
No EOL
2.9 KiB
YAML
89 lines
No EOL
2.9 KiB
YAML
name: Create docker images
|
|
|
|
on:
|
|
create:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Tag to build (e.g., v2.10.0, v2.10, v2)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
name: Build, push, and deploy
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
db-type: [postgresql, mysql]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Set env
|
|
run: |
|
|
echo "NOW=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
|
|
|
|
- name: Generate tags
|
|
id: generate_tags
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
TAG=${{ inputs.tag }}
|
|
else
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
fi
|
|
|
|
# Ensure tag starts with 'v'
|
|
if [[ ! $TAG =~ ^v ]]; then
|
|
TAG="v${TAG}"
|
|
fi
|
|
|
|
# Remove 'v' prefix for splitting
|
|
VERSION=${TAG#v}
|
|
|
|
# Split version into parts
|
|
IFS='.' read -ra PARTS <<< "$VERSION"
|
|
|
|
# Generate tags based on number of version parts (keeping 'v' prefix)
|
|
if [ ${#PARTS[@]} -eq 1 ]; then
|
|
# Only major version (e.g., v2)
|
|
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}" >> $GITHUB_ENV
|
|
elif [ ${#PARTS[@]} -eq 2 ]; then
|
|
# Major.minor version (e.g., v2.10)
|
|
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}, ${{ matrix.db-type }}-v${PARTS[0]}.${PARTS[1]}" >> $GITHUB_ENV
|
|
else
|
|
# Full version (e.g., v2.10.0)
|
|
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}, ${{ matrix.db-type }}-v${PARTS[0]}.${PARTS[1]}, ${{ matrix.db-type }}-v${VERSION}" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- uses: mr-smithers-excellent/docker-build-push@v6
|
|
name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }}
|
|
with:
|
|
image: umami
|
|
tags: ${{ env.TAGS }}
|
|
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
|
|
registry: ghcr.io
|
|
multiPlatform: true
|
|
platform: linux/amd64,linux/arm64
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: mr-smithers-excellent/docker-build-push@v6
|
|
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
|
|
with:
|
|
image: umamisoftware/umami
|
|
tags: ${{ env.TAGS }}
|
|
buildArgs: DATABASE_TYPE=${{ matrix.db-type }}
|
|
registry: docker.io
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }} |