Updated workflow to only run on tag publish.
Some checks failed
Node.js CI / build (mysql, 18.18, 10) (push) Has been cancelled
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled

This commit is contained in:
Mike Cao 2025-10-04 13:32:40 -07:00
parent aaf92058d4
commit 35c27589b7

View file

@ -2,17 +2,8 @@ name: Create docker images
on: on:
push: push:
branches: tags:
- master - 'v*.*.*'
- main
- dev
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches:
- master
- main
- dev
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -22,36 +13,31 @@ 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:
matrix: matrix:
db-type: [postgresql, mysql] db-type: [postgresql]
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
# Install the cosign tool except on PR # Install cosign (for image signing)
# 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 registry docker.io - name: Log into Docker Hub
if: github.event_name != 'pull_request' && github.repository == 'umami-software/umami' if: 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 registry - name: Log into GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
@ -69,14 +55,8 @@ 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
@ -86,15 +66,14 @@ 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: ${{ github.event_name != 'pull_request' }} push: true
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 resulting Docker image digest except on PRs. # Sign the published image digest
- 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 }}