Repository navigation
83 lines (72 loc) · 2.96 KB
/
Copy pathdebug-images.yml
File metadata and controls
83 lines (72 loc) · 2.96 KB
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
# Copyright 2026 Katteli Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds the database images of debug/ and pushes each to Docker Hub as a
# tag of testflows/machine-examples, by name and version:
#
# :clickhouse-server-26.8.31.2 :clickhouse-debug-26.8.31.2
# :postgresql-server-17.11 :postgresql-debug-17.11
#
# and the same with -YYYYMMDD-HHMM, so a rebuild of one version keeps the
# builds before it. The version is the server's, from its Dockerfile's FROM
# line: a new server release is a new tag beside the old ones. Run by hand: a
# new image is a release.
name: 🐳 Publish debug images
on:
workflow_dispatch:
permissions:
contents: read
env:
IMAGE: testflows/machine-examples
jobs:
publish:
runs-on: ubuntu-latest
# Docker Hub's credentials are the environment's, which only main
# deploys to: a workflow of another branch cannot read them.
environment: dockerhub
strategy:
fail-fast: false
matrix:
example: [clickhouse, postgresql]
target: [server, debug]
steps:
- uses: actions/checkout@v4
- name: Version
id: version
working-directory: debug/${{ matrix.example }}
run: |
version=$(sed -n 's/^FROM .*:\([0-9][0-9.]*\) AS server$/\1/p' Dockerfile)
test -n "$version"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "built=$(date -u +%Y%m%d-%H%M)" >> "$GITHUB_OUTPUT"
# The debug images are gigabytes: room for them on the runner.
- name: Disk space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: debug/${{ matrix.example }}
target: ${{ matrix.target }}
platforms: linux/amd64
push: true
tags: |
${{ env.IMAGE }}:${{ matrix.example }}-${{ matrix.target }}-${{ steps.version.outputs.version }}
${{ env.IMAGE }}:${{ matrix.example }}-${{ matrix.target }}-${{ steps.version.outputs.version }}-${{ steps.version.outputs.built }}
- name: Summary
run: |
tag="${{ matrix.example }}-${{ matrix.target }}-${{ steps.version.outputs.version }}"
echo "### Published $IMAGE:$tag and :$tag-${{ steps.version.outputs.built }}" >> "$GITHUB_STEP_SUMMARY"