-
Notifications
You must be signed in to change notification settings - Fork 269
75 lines (63 loc) · 2.33 KB
/
publish-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Publish Debian Container Images
on:
push:
tags-ignore:
- "invoiceninja-*"
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: invoiceninja/invoiceninja-debian
context: ./debian
steps:
- name: Checkout
uses: actions/checkout@v4 # Updated from v2
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 QEMU
uses: docker/setup-qemu-action@v3 # Updated from v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3 # Updated from v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3 # Updated from v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5 # Updated from v2
with:
context: ${{ matrix.context }}
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha # Updated cache type
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}