-
Notifications
You must be signed in to change notification settings - Fork 6
67 lines (60 loc) · 2.97 KB
/
Copy pathpublish-docker-image.yml
File metadata and controls
67 lines (60 loc) · 2.97 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
name: dApp image build status (dry-run)
# Reports what the dApp image build WOULD produce on each push to dApp-framework, WITHOUT building
# or pushing anything yet. Keeps CI "in the loop" while the base-build story is settled.
#
# The heavy base (UHD + deps + libe3 + OAI) is built locally via docker/build-base.sh and pushed to
# ghcr.io/wineslab/dapp-oai-base (linked to this repo via the image's org.opencontainers.image.source
# label). When ready to publish the dApp image, add docker login + build/push steps using the values
# this job already computes (tags: :latest and :<dApp-library VERSION>).
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
report:
name: Report would-be dApp image build
if: github.repository == 'wineslab/dapp-framework'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed to diff submodule pointers across the push
- name: Compute and report would-be build
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
IMAGE="ghcr.io/${{ github.repository_owner }}/dapp-oai"
SUBS="dApp-openairinterface5g dApp-library dApp-flexric dApp-libe3"
FW_SHA="$(git rev-parse --short HEAD)"
# Which submodule pointers changed in this push (n/a for manual dispatch / initial push).
before="${{ github.event.before }}"
changed="(n/a — not a push diff)"
if [ "${{ github.event_name }}" = "push" ] && [ -n "$before" ] \
&& [ "$before" != "0000000000000000000000000000000000000000" ]; then
changed="$(git diff --name-only "$before" "${{ github.sha }}" -- $SUBS | tr '\n' ' ')"
[ -z "$changed" ] && changed="(none)"
fi
# dApp-library VERSION at the pinned commit, without checking the submodule out.
dapp_sha="$(git rev-parse 'HEAD:dApp-library')"
version="$(gh api "repos/wineslab/dApp-library/contents/VERSION?ref=$dapp_sha" \
--jq '.content' 2>/dev/null | base64 -d 2>/dev/null | tr -d '[:space:]' || true)"
[ -z "$version" ] && version="unknown"
{
echo "## dApp image — dry-run (no build / no push)"
echo ""
echo "| field | value |"
echo "|---|---|"
echo "| framework commit | \`$FW_SHA\` |"
echo "| changed submodules | $changed |"
echo "| dApp-library pinned | \`${dapp_sha:0:12}\` (VERSION \`$version\`) |"
echo "| would-be tags | \`$IMAGE:latest\`, \`$IMAGE:$version\` |"
echo ""
case " $changed " in
*dApp-openairinterface5g*|*dApp-flexric*|*dApp-libe3*)
echo "> :warning: A base-affecting submodule (OAI / FlexRIC / libe3) changed — rebuild the base locally with \`./docker/build-base.sh\` before publishing." ;;
esac
} | tee -a "$GITHUB_STEP_SUMMARY"