Skip to content

Commit 4a55973

Browse files
committed
ci: add semantic-release and update docker tag scheme
- Add semantic-release for automated versioning based on commits - Update docker tags: master-* -> latest-*, add develop-* tags - Add workflow_dispatch for manual docker builds - Update nightly builds to actually push images - Update example docker-compose files with new tags
1 parent 9d079dc commit 4a55973

File tree

7 files changed

+327
-220
lines changed

7 files changed

+327
-220
lines changed
Lines changed: 95 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
name: Docker
2+
23
on:
34
push:
4-
branches: [ master, beta ]
5-
# Publish semver tags as releases.
6-
tags: [ 'v*.*.*' ]
5+
branches:
6+
- master
7+
- develop
8+
tags:
9+
- 'v*.*.*'
10+
workflow_dispatch:
11+
inputs:
12+
tag_suffix:
13+
description: 'Tag suffix (e.g., latest, develop, or version like 1.0.0)'
14+
required: true
15+
default: 'latest'
716

817
env:
918
REGISTRY: ghcr.io
@@ -18,52 +27,55 @@ jobs:
1827

1928
steps:
2029
- name: Checkout repository
21-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
2231
with:
2332
fetch-depth: 0
33+
2434
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v2
35+
uses: docker/setup-qemu-action@v3
2636
with:
2737
platforms: 'arm64,arm'
38+
2839
- name: Set up Docker Buildx
29-
uses: docker/setup-buildx-action@v2
30-
# Login against a Docker registry except on PR
31-
# https://github.com/docker/login-action
40+
uses: docker/setup-buildx-action@v3
41+
3242
- name: Log into registry ${{ env.REGISTRY }}
3343
if: github.event_name != 'pull_request'
34-
uses: docker/login-action@v2
44+
uses: docker/login-action@v3
3545
with:
3646
registry: ${{ env.REGISTRY }}
3747
username: ${{ github.actor }}
3848
password: ${{ secrets.GITHUB_TOKEN }}
39-
# Extract metadata (tags, labels) for Docker
40-
# https://github.com/docker/metadata-action
49+
4150
- name: Extract Docker metadata
4251
id: meta
43-
uses: docker/metadata-action@v4
52+
uses: docker/metadata-action@v5
4453
with:
54+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4555
flavor: |
4656
latest=false
4757
tags: |
48-
type=ref,enable=true,event=branch,suffix=-collector
49-
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},suffix=-collector
50-
type=semver,pattern=v{{major}}.{{minor}},suffix=-collector
51-
type=semver,pattern=v{{major}},suffix=-collector
52-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58+
# Manual trigger
59+
type=raw,value=${{ inputs.tag_suffix }}-collector,enable=${{ github.event_name == 'workflow_dispatch' }}
60+
# Branch builds
61+
type=raw,value=latest-collector,enable=${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
62+
type=raw,value=develop-collector,enable=${{ github.ref == 'refs/heads/develop' && github.event_name != 'workflow_dispatch' }}
63+
# Version tags
64+
type=semver,pattern={{version}}-collector
65+
type=semver,pattern={{major}}.{{minor}}-collector
66+
type=semver,pattern={{major}}-collector,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
5367
54-
# Build and push Docker image with Buildx (don't push on PR)
55-
# https://github.com/docker/build-push-action
5668
- name: Build and push Docker image
57-
uses: docker/build-push-action@v3
69+
uses: docker/build-push-action@v5
5870
with:
5971
platforms: linux/amd64,linux/arm64,linux/arm/v7
6072
context: .
6173
file: docker/Dockerfile.collector
62-
push: ${{ github.event_name != 'pull_request' }}
74+
push: true
6375
tags: ${{ steps.meta.outputs.tags }}
6476
labels: ${{ steps.meta.outputs.labels }}
65-
# cache-from: type=gha
66-
# cache-to: type=gha,mode=max
77+
cache-from: type=gha
78+
cache-to: type=gha,mode=max
6779

6880
web:
6981
runs-on: ubuntu-latest
@@ -73,51 +85,57 @@ jobs:
7385

7486
steps:
7587
- name: Checkout repository
76-
uses: actions/checkout@v2
77-
- name: "Populate frontend version information"
78-
run: "cd webapp/frontend && ./git.version.sh"
88+
uses: actions/checkout@v4
89+
90+
- name: Populate frontend version information
91+
run: cd webapp/frontend && ./git.version.sh
92+
7993
- name: Set up QEMU
80-
uses: docker/setup-qemu-action@v2
94+
uses: docker/setup-qemu-action@v3
8195
with:
8296
platforms: 'arm64,arm'
97+
8398
- name: Set up Docker Buildx
84-
uses: docker/setup-buildx-action@v2
85-
# Login against a Docker registry except on PR
86-
# https://github.com/docker/login-action
99+
uses: docker/setup-buildx-action@v3
100+
87101
- name: Log into registry ${{ env.REGISTRY }}
88102
if: github.event_name != 'pull_request'
89-
uses: docker/login-action@v2
103+
uses: docker/login-action@v3
90104
with:
91105
registry: ${{ env.REGISTRY }}
92106
username: ${{ github.actor }}
93107
password: ${{ secrets.GITHUB_TOKEN }}
94-
# Extract metadata (tags, labels) for Docker
95-
# https://github.com/docker/metadata-action
108+
96109
- name: Extract Docker metadata
97110
id: meta
98-
uses: docker/metadata-action@v4
111+
uses: docker/metadata-action@v5
99112
with:
113+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
100114
flavor: |
101115
latest=false
102116
tags: |
103-
type=ref,enable=true,event=branch,suffix=-web
104-
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},suffix=-web
105-
type=semver,pattern=v{{major}}.{{minor}},suffix=-web
106-
type=semver,pattern=v{{major}},suffix=-web
107-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
108-
# Build and push Docker image with Buildx (don't push on PR)
109-
# https://github.com/docker/build-push-action
117+
# Manual trigger
118+
type=raw,value=${{ inputs.tag_suffix }}-web,enable=${{ github.event_name == 'workflow_dispatch' }}
119+
# Branch builds
120+
type=raw,value=latest-web,enable=${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
121+
type=raw,value=develop-web,enable=${{ github.ref == 'refs/heads/develop' && github.event_name != 'workflow_dispatch' }}
122+
# Version tags
123+
type=semver,pattern={{version}}-web
124+
type=semver,pattern={{major}}.{{minor}}-web
125+
type=semver,pattern={{major}}-web,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
126+
110127
- name: Build and push Docker image
111-
uses: docker/build-push-action@v3
128+
uses: docker/build-push-action@v5
112129
with:
113130
platforms: linux/amd64,linux/arm64,linux/arm/v7
114131
context: .
115132
file: docker/Dockerfile.web
116-
push: ${{ github.event_name != 'pull_request' }}
133+
push: true
117134
tags: ${{ steps.meta.outputs.tags }}
118135
labels: ${{ steps.meta.outputs.labels }}
119-
# cache-from: type=gha
120-
# cache-to: type=gha,mode=max
136+
cache-from: type=gha
137+
cache-to: type=gha,mode=max
138+
121139
omnibus:
122140
runs-on: ubuntu-latest
123141
permissions:
@@ -126,46 +144,56 @@ jobs:
126144

127145
steps:
128146
- name: Checkout repository
129-
uses: actions/checkout@v2
130-
- name: "Populate frontend version information"
131-
run: "cd webapp/frontend && ./git.version.sh"
147+
uses: actions/checkout@v4
148+
149+
- name: Populate frontend version information
150+
run: cd webapp/frontend && ./git.version.sh
151+
132152
- name: Set up QEMU
133-
uses: docker/setup-qemu-action@v2
153+
uses: docker/setup-qemu-action@v3
134154
with:
135155
platforms: 'arm64,arm'
156+
136157
- name: Set up Docker Buildx
137-
uses: docker/setup-buildx-action@v2
138-
# Login against a Docker registry except on PR
139-
# https://github.com/docker/login-action
158+
uses: docker/setup-buildx-action@v3
159+
140160
- name: Log into registry ${{ env.REGISTRY }}
141161
if: github.event_name != 'pull_request'
142-
uses: docker/login-action@v2
162+
uses: docker/login-action@v3
143163
with:
144164
registry: ${{ env.REGISTRY }}
145165
username: ${{ github.actor }}
146166
password: ${{ secrets.GITHUB_TOKEN }}
147-
# Extract metadata (tags, labels) for Docker
148-
# https://github.com/docker/metadata-action
167+
149168
- name: Extract Docker metadata
150169
id: meta
151-
uses: docker/metadata-action@v4
170+
uses: docker/metadata-action@v5
152171
with:
153-
tags: |
154-
type=ref,enable=true,event=branch,suffix=-omnibus
155-
type=semver,pattern=v{{major}}.{{minor}}.{{patch}},suffix=-omnibus
156-
type=semver,pattern=v{{major}}.{{minor}},suffix=-omnibus
157-
type=semver,pattern=v{{major}},suffix=-omnibus
158172
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
159-
# Build and push Docker image with Buildx (don't push on PR)
160-
# https://github.com/docker/build-push-action
173+
flavor: |
174+
latest=false
175+
tags: |
176+
# Manual trigger
177+
type=raw,value=${{ inputs.tag_suffix }}-omnibus,enable=${{ github.event_name == 'workflow_dispatch' }}
178+
type=raw,value=${{ inputs.tag_suffix }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag_suffix == 'latest' }}
179+
# Branch builds
180+
type=raw,value=latest-omnibus,enable=${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
181+
type=raw,value=develop-omnibus,enable=${{ github.ref == 'refs/heads/develop' && github.event_name != 'workflow_dispatch' }}
182+
# Version tags
183+
type=semver,pattern={{version}}-omnibus
184+
type=semver,pattern={{major}}.{{minor}}-omnibus
185+
type=semver,pattern={{major}}-omnibus,enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
186+
# Default latest tag (omnibus is the default)
187+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' && github.event_name != 'workflow_dispatch' }}
188+
161189
- name: Build and push Docker image
162-
uses: docker/build-push-action@v3
190+
uses: docker/build-push-action@v5
163191
with:
164192
platforms: linux/amd64,linux/arm64
165193
context: .
166194
file: docker/Dockerfile
167-
push: ${{ github.event_name != 'pull_request' }}
195+
push: true
168196
tags: ${{ steps.meta.outputs.tags }}
169197
labels: ${{ steps.meta.outputs.labels }}
170-
# cache-from: type=gha
171-
# cache-to: type=gha,mode=max
198+
cache-from: type=gha
199+
cache-to: type=gha,mode=max
Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,82 @@
11
name: Docker - Nightly
2+
23
on:
34
schedule:
4-
- cron: '36 12 * * *'
5+
- cron: '0 4 * * *'
6+
workflow_dispatch:
57

68
env:
79
REGISTRY: ghcr.io
810
IMAGE_NAME: ${{ github.repository }}
911

1012
jobs:
11-
omnibus:
13+
nightly:
1214
runs-on: ubuntu-latest
1315
permissions:
1416
contents: read
1517
packages: write
1618

1719
steps:
1820
- name: Checkout repository
19-
uses: actions/checkout@v2
20-
- name: "Populate frontend version information"
21-
run: "cd webapp/frontend && ./git.version.sh"
21+
uses: actions/checkout@v4
22+
with:
23+
ref: develop
24+
25+
- name: Populate frontend version information
26+
run: cd webapp/frontend && ./git.version.sh
27+
2228
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v2
29+
uses: docker/setup-qemu-action@v3
2430
with:
2531
platforms: 'arm64,arm'
32+
2633
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v2
28-
# Login against a Docker registry except on PR
29-
# https://github.com/docker/login-action
34+
uses: docker/setup-buildx-action@v3
35+
3036
- name: Log into registry ${{ env.REGISTRY }}
31-
if: github.event_name != 'pull_request'
32-
uses: docker/login-action@v2
37+
uses: docker/login-action@v3
3338
with:
3439
registry: ${{ env.REGISTRY }}
3540
username: ${{ github.actor }}
3641
password: ${{ secrets.GITHUB_TOKEN }}
37-
# Extract metadata (tags, labels) for Docker
38-
# https://github.com/docker/metadata-action
39-
- name: Extract Docker metadata
40-
id: meta
41-
uses: docker/metadata-action@v4
42-
with:
43-
tags: |
44-
type=ref,enable=true,event=branch,suffix=-omnibus-nightly
45-
type=ref,enable=true,event=tag,suffix=-omnibus-nightly
46-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47-
# Build and push Docker image with Buildx (don't push on PR)
48-
# https://github.com/docker/build-push-action
49-
- name: Build and push Docker image
50-
uses: docker/build-push-action@v3
42+
43+
- name: Get current date
44+
id: date
45+
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
46+
47+
- name: Build and push nightly omnibus
48+
uses: docker/build-push-action@v5
5149
with:
5250
platforms: linux/amd64,linux/arm64
5351
context: .
5452
file: docker/Dockerfile
55-
push: false
56-
tags: ${{ steps.meta.outputs.tags }}
57-
labels: ${{ steps.meta.outputs.labels }}
58-
# cache-from: type=gha
59-
# cache-to: type=gha,mode=max
53+
push: true
54+
tags: |
55+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
56+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-${{ steps.date.outputs.date }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
60+
- name: Build and push nightly web
61+
uses: docker/build-push-action@v5
62+
with:
63+
platforms: linux/amd64,linux/arm64,linux/arm/v7
64+
context: .
65+
file: docker/Dockerfile.web
66+
push: true
67+
tags: |
68+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-web
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
72+
- name: Build and push nightly collector
73+
uses: docker/build-push-action@v5
74+
with:
75+
platforms: linux/amd64,linux/arm64,linux/arm/v7
76+
context: .
77+
file: docker/Dockerfile.collector
78+
push: true
79+
tags: |
80+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly-collector
81+
cache-from: type=gha
82+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)