-
Notifications
You must be signed in to change notification settings - Fork 761
160 lines (139 loc) · 5.39 KB
/
docker-release.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: docker-release
on:
push:
branches:
- stable
- develop
tags:
- '*'
jobs:
docker-build-image:
strategy:
matrix:
runs-on:
- runner: ubuntu-22.04
platform: 'amd64'
- runner: ['self-hosted', 'arm64']
platform: 'arm64'
runs-on: ${{ matrix.runs-on.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to docker.io container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Get tags for platform specific image
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/zammad
index.docker.io/${{ github.repository_owner }}/zammad
index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
quay.io/${{ github.repository_owner }}/zammad
tags: |
type=sha,suffix=-${{ matrix.runs-on.platform }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
push: true
tags: ${{ steps.meta.outputs.tags }}
docker-create-multiarch-manifest:
runs-on: ubuntu-22.04
needs:
- docker-build-image
strategy:
matrix:
target:
- image: ghcr.io/${{ github.repository_owner }}/zammad
- image: index.docker.io/${{ github.repository_owner }}/zammad
- image: quay.io/${{ github.repository_owner }}/zammad
- image: index.docker.io/${{ github.repository_owner }}/zammad-docker-compose
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to docker.io container registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay.io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Get tag for amd64 image
id: meta_arch_amd64
uses: docker/metadata-action@v5
with:
images: ${{ matrix.target.image }}
tags: |
type=sha,suffix=-amd64
- name: Get tag for arm64 image
id: meta_arch_arm64
uses: docker/metadata-action@v5
with:
images: ${{ matrix.target.image }}
tags: |
type=sha,suffix=-arm64
- name: Get incrementing Zammad version from the most recent tag
run: echo ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')" >> $GITHUB_ENV
- name: Get Zammad major.minor version from the most recent tag
run: echo ZAMMAD_VERSION_MAJOR_MINOR="$(git describe --tags | cut -f1-2 -d.)" >> $GITHUB_ENV
- name: Get Zammad major version from the most recent tag
run: echo ZAMMAD_VERSION_MAJOR="$(git describe --tags | cut -f1 -d.)" >> $GITHUB_ENV
- name: Get tags for final multiarch reference
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.target.image }}
# Don't automatically generate a 'latest' tag for the default branch.
# https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input
flavor: |
latest=false
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=raw,value=${{ env.ZAMMAD_VERSION }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR_MINOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=raw,value=${{ env.ZAMMAD_VERSION_MAJOR }},enable=${{ github.ref == format('refs/heads/{0}', 'stable') }}
type=ref,event=branch
type=ref,event=tag
type=sha
- name: Create manifest list and push
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") ${{ steps.meta_arch_amd64.outputs.tags }} ${{ steps.meta_arch_arm64.outputs.tags }}
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ matrix.target.image }}:${{ steps.meta.outputs.version }}