Updated Docker build.
Some checks failed
Node.js CI / build (push) Has been cancelled

This commit is contained in:
Mike Cao 2025-12-11 20:16:56 -08:00
parent 9b0d1b092e
commit 860e6390f1

View file

@ -65,7 +65,8 @@ jobs:
VERSION="" VERSION=""
fi fi
TAGS="" GHCR_TAGS=""
DOCKER_TAGS=""
if [[ -n "$VERSION" ]]; then if [[ -n "$VERSION" ]]; then
MAJOR=$(echo "$VERSION" | cut -d. -f1) MAJOR=$(echo "$VERSION" | cut -d. -f1)
@ -73,43 +74,54 @@ jobs:
if [[ "$VERSION" == *-* ]]; then if [[ "$VERSION" == *-* ]]; then
# prerelease: only version tag # prerelease: only version tag
TAGS="$VERSION" GHCR_TAGS="ghcr.io/${{ github.repository }}:$VERSION"
DOCKER_TAGS="umamisoftware/umami:$VERSION"
else else
# stable release: version + hierarchy # stable release: version + hierarchy
TAGS="$VERSION,${MAJOR}.${MINOR},${MAJOR},postgresql-latest" GHCR_TAGS="ghcr.io/${{ github.repository }}:$VERSION"
GHCR_TAGS="$GHCR_TAGS,ghcr.io/${{ github.repository }}:${MAJOR}.${MINOR}"
GHCR_TAGS="$GHCR_TAGS,ghcr.io/${{ github.repository }}:${MAJOR}"
GHCR_TAGS="$GHCR_TAGS,ghcr.io/${{ github.repository }}:postgresql-latest"
DOCKER_TAGS="umamisoftware/umami:$VERSION"
DOCKER_TAGS="$DOCKER_TAGS,umamisoftware/umami:${MAJOR}.${MINOR}"
DOCKER_TAGS="$DOCKER_TAGS,umamisoftware/umami:${MAJOR}"
DOCKER_TAGS="$DOCKER_TAGS,umamisoftware/umami:postgresql-latest"
# Add latest tag based on trigger and input # Add latest tag based on trigger and input
if [[ "$REF_TYPE" == "tag" ]] || [[ "$INCLUDE_LATEST" == "true" ]]; then if [[ "$REF_TYPE" == "tag" ]] || [[ "$INCLUDE_LATEST" == "true" ]]; then
TAGS="${TAGS},latest" GHCR_TAGS="$GHCR_TAGS,ghcr.io/${{ github.repository }}:latest"
DOCKER_TAGS="$DOCKER_TAGS,umamisoftware/umami:latest"
fi fi
fi fi
else else
# Non-tag build (e.g. from main branch) # Non-tag build (e.g. from main branch)
TAGS="${REF_NAME}" GHCR_TAGS="ghcr.io/${{ github.repository }}:${REF_NAME}"
DOCKER_TAGS="umamisoftware/umami:${REF_NAME}"
fi fi
echo "tags=$TAGS" >> $GITHUB_OUTPUT echo "ghcr_tags=$GHCR_TAGS" >> $GITHUB_OUTPUT
echo "Computed tags: $TAGS" echo "docker_tags=$DOCKER_TAGS" >> $GITHUB_OUTPUT
echo "Computed GHCR tags: $GHCR_TAGS"
echo "Computed Docker Hub tags: $DOCKER_TAGS"
- name: Build and push to GHCR - name: Build and push to GHCR
uses: mr-smithers-excellent/docker-build-push@v6 uses: docker/build-push-action@v5
with: with:
image: ${{ github.repository }} context: .
tags: ${{ steps.compute.outputs.tags }} platforms: linux/amd64,linux/arm64
registry: ghcr.io push: true
multiPlatform: true tags: ${{ steps.compute.outputs.ghcr_tags }}
platform: linux/amd64,linux/arm64 cache-from: type=gha
username: ${{ github.actor }} cache-to: type=gha,mode=max
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to Docker Hub - name: Build and push to Docker Hub
if: github.repository == 'umami-software/umami' if: github.repository == 'umami-software/umami'
uses: mr-smithers-excellent/docker-build-push@v6 uses: docker/build-push-action@v5
with: with:
image: umamisoftware/umami context: .
tags: ${{ steps.compute.outputs.tags }} platforms: linux/amd64,linux/arm64
registry: docker.io push: true
multiPlatform: true tags: ${{ steps.compute.outputs.docker_tags }}
platform: linux/amd64,linux/arm64 cache-from: type=gha
username: ${{ secrets.DOCKER_USERNAME }} cache-to: type=gha,mode=max
password: ${{ secrets.DOCKER_PASSWORD }}