Files
invoiceninja-docker/.github/workflows/publish-image.yaml
2025-09-29 22:14:49 +02:00

72 lines
2.2 KiB
YAML

name: Publish Debian Container Images
on:
push:
tags-ignore:
- "invoiceninja-*"
jobs:
docker:
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
include:
- image: invoiceninja/invoiceninja-debian
context: debian
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{ matrix.image }}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
MAJOR="$(echo "${VERSION}" | cut -d. -f1)"
MINOR="$(echo "${VERSION}" | cut -d. -f2)"
TAGS="$TAGS,${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:${MAJOR}.${MINOR}"
# Debug output
echo "Current version: ${VERSION}"
echo "Version pattern check: $([[ $VERSION =~ ^5\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "matches" || echo "doesn't match")"
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT # Updated output syntax
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}