Skip to content

Commit d799a33

Browse files
committed
ci(build): consolidate rotating build workflows + publish version.php-derived tags
Collapse build-800/810/811.yml into a single build-openemr.yml whose matrix is the stable slot names [current, next, dev] x platform, never rotated. Each job resolves its version at runtime from the docker/openemr/{current,next,dev} symlinks, so the workflow holds zero version strings and SlotRotator only re-points the symlink. Publish each slot's true version.php-derived tag instead of the bare symlink dir name: current -> 8.0.0.3, next -> 8.1.0, dev -> 8.1.1-dev. This fixes current (really the 8.0.0.3 patch release) and prevents dev from publishing a bare :8.1.1 that would collide with the eventual real 8.1.1 release. Supporting changes: standardize 8.0.0/Dockerfile to ARG OPENEMR_VERSION=rel-800; update versions.yml (current.full -> 8.0.0.3, dev.full -> 8.1.1-dev); update Docker Hub overview template + renderer test; document the derivation in release-automation-plan.md. This is the build-workflow half of step #5 (workflow consolidation, openemr#638 follow-on) and unblocks the release-rotation PR (openemr#760). Assisted-by: Claude Code
1 parent 5b3eaf1 commit d799a33

15 files changed

Lines changed: 338 additions & 304 deletions

File tree

.github/workflows/build-800.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/build-810.yml

Lines changed: 0 additions & 98 deletions
This file was deleted.

.github/workflows/build-811.yml

Lines changed: 0 additions & 98 deletions
This file was deleted.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: OpenEMR Docker Build (current/next/dev)
2+
3+
# One workflow for all three rotating slots. The matrix is the STABLE slot
4+
# names — never rotated. The actual OpenEMR version for each slot is carried by
5+
# the slot-named symlinks docker/openemr/{current,next,dev} -> the real version
6+
# dirs (e.g. 8.0.0). Rotation flips the symlinks (tools/release/SlotRotator),
7+
# so this file holds no version strings and never needs rewriting.
8+
9+
on:
10+
workflow_dispatch:
11+
schedule:
12+
- cron: '0 2 * * *' # run at 2 AM UTC
13+
14+
jobs:
15+
build:
16+
if: github.repository_owner == 'openemr' && github.repository == 'openemr/openemr-devops' && github.ref == 'refs/heads/master'
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
slot: [current, next, dev]
21+
platform:
22+
- arch: linux/amd64
23+
runner: ubuntu-24.04
24+
- arch: linux/arm64
25+
runner: ubuntu-24.04-arm
26+
runs-on: ${{ matrix.platform.runner }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v6
30+
31+
- name: Resolve slot version
32+
id: resolve
33+
run: |
34+
dir="$(basename "$(readlink "docker/openemr/${{ matrix.slot }}")")"
35+
echo "dir=$dir" >> "$GITHUB_OUTPUT"
36+
37+
- name: Prepare platform pair
38+
run: |
39+
platform=${{ matrix.platform.arch }}
40+
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v4
44+
45+
- name: Login to Docker Hub
46+
uses: docker/login-action@v4
47+
with:
48+
username: ${{ secrets.DOCKERHUB_USERNAME }}
49+
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+
- name: Build and push by digest
52+
id: build
53+
uses: docker/build-push-action@v7
54+
with:
55+
context: docker/openemr/${{ steps.resolve.outputs.dir }}
56+
platforms: ${{ matrix.platform.arch }}
57+
outputs: type=image,name=openemr/openemr,push-by-digest=true,name-canonical=true,push=true
58+
no-cache: true
59+
60+
- name: Export digest
61+
run: |
62+
mkdir -p /tmp/digests
63+
digest="${{ steps.build.outputs.digest }}"
64+
touch "/tmp/digests/${digest#sha256:}"
65+
66+
- name: Upload digest
67+
uses: actions/upload-artifact@v7
68+
with:
69+
name: digests-${{ matrix.slot }}-${{ env.PLATFORM_PAIR }}
70+
path: /tmp/digests/*
71+
if-no-files-found: error
72+
retention-days: 1
73+
74+
merge:
75+
if: github.repository_owner == 'openemr' && github.repository == 'openemr/openemr-devops' && github.ref == 'refs/heads/master'
76+
runs-on: ubuntu-24.04
77+
needs: build
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
include:
82+
- slot: current
83+
float: latest
84+
bare_dir: true
85+
- slot: next
86+
float: next
87+
bare_dir: true
88+
- slot: dev
89+
float: dev
90+
bare_dir: false
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v6
94+
95+
- name: Resolve slot version
96+
id: resolve
97+
run: |
98+
dir="$(basename "$(readlink "docker/openemr/${{ matrix.slot }}")")"
99+
ref="$(grep -oE '^ARG OPENEMR_VERSION=[A-Za-z0-9._-]+' "docker/openemr/${dir}/Dockerfile" | head -1 | cut -d= -f2)"
100+
curl -fsSL "https://raw.githubusercontent.com/openemr/openemr/${ref}/version.php" -o /tmp/version.php
101+
# shellcheck disable=SC2016 # PHP variables, not shell
102+
ver="$(php -r 'require "/tmp/version.php"; $rp = $v_realpatch > 0 ? "." . $v_realpatch : ""; echo $v_major . "." . $v_minor . "." . $v_patch . $rp . $v_tag;')"
103+
echo "dir=$dir" >> "$GITHUB_OUTPUT"
104+
echo "ver=$ver" >> "$GITHUB_OUTPUT"
105+
106+
- name: Download digests
107+
uses: actions/download-artifact@v8
108+
with:
109+
path: /tmp/digests
110+
pattern: digests-${{ matrix.slot }}-*
111+
merge-multiple: true
112+
113+
- name: Set up Docker Buildx
114+
uses: docker/setup-buildx-action@v4
115+
116+
- name: Login to Docker Hub
117+
uses: docker/login-action@v4
118+
with:
119+
username: ${{ secrets.DOCKERHUB_USERNAME }}
120+
password: ${{ secrets.DOCKERHUB_TOKEN }}
121+
122+
- name: Get build date
123+
id: build_date
124+
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
125+
126+
- name: Create manifest and push
127+
working-directory: /tmp/digests
128+
env:
129+
VER: ${{ steps.resolve.outputs.ver }}
130+
DIR: ${{ steps.resolve.outputs.dir }}
131+
FLOAT: ${{ matrix.float }}
132+
BUILD_DATE: ${{ steps.build_date.outputs.date }}
133+
BARE_DIR: ${{ matrix.bare_dir }}
134+
run: |
135+
mapfile -t digests < <(find . -maxdepth 1 -type f -printf 'openemr/openemr@sha256:%f\n')
136+
tags=(-t "openemr/openemr:${VER}" -t "openemr/openemr:${FLOAT}" -t "openemr/openemr:${VER}-${BUILD_DATE}")
137+
if [ "${BARE_DIR}" = "true" ] && [ "${DIR}" != "${VER}" ]; then
138+
tags+=(-t "openemr/openemr:${DIR}")
139+
fi
140+
docker buildx imagetools create "${tags[@]}" "${digests[@]}"
141+
142+
- name: Push Docker Hub readme
143+
uses: ./.github/actions/push-dockerhub-readme
144+
with:
145+
username: ${{ secrets.DOCKERHUB_USERNAME }}
146+
password: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)