Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit 84d0f72

Browse files
committed
Publish sha256 of each library after build + before publish
1 parent ff321a6 commit 84d0f72

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ jobs:
5858
shell: bash
5959
run: |
6060
set -euo pipefail
61-
plat="$(find libs -mindepth 1 -maxdepth 1 -type d -printf '%f\n')"
62-
if [[ -z "$plat" || $(echo "$plat" | wc -l) -ne 1 ]]; then
63-
echo "Expected exactly one platform dir in libs/, got:"
64-
find libs -mindepth 1 -maxdepth 1 -type d -printf ' - %f\n'
61+
shopt -s nullglob
62+
dirs=(libs/*/)
63+
if (( ${#dirs[@]} != 1 )); then
64+
echo "Expected exactly one platform dir in libs/, found:"
65+
for d in "${dirs[@]}"; do echo " - ${d#libs/}"; done
6566
exit 1
6667
fi
68+
plat="${dirs[0]%/}"; plat="${plat#libs/}"
6769
echo "dir=$plat" >> "$GITHUB_OUTPUT"
6870
echo "Platform dir: $plat"
6971
@@ -94,15 +96,23 @@ jobs:
9496
shell: bash
9597
run: |
9698
set -euo pipefail
99+
shopt -s nullglob
97100
mkdir -p libs
101+
echo "Downloaded artifact roots:"
98102
for d in _libs_artifacts/*; do
99-
plat="$(basename "$d")"
100-
echo "Syncing $d -> libs/$plat"
101-
mkdir -p "libs/$plat"
102-
rsync -a "$d/." "libs/$plat/"
103+
[ -d "$d" ] && echo " - $(basename "$d")"
103104
done
105+
for src in _libs_artifacts/*; do
106+
[ -d "$src" ] || continue
107+
plat="$(basename "$src")"
108+
dest="libs/$plat"
109+
echo "Syncing $src -> $dest"
110+
mkdir -p "$dest"
111+
rsync -a "$src"/ "$dest"/
112+
done
113+
104114
echo "Merged libs layout:"
105-
find libs -maxdepth 2 -type f -print
115+
for f in libs/*/*; do [ -f "$f" ] && echo "$f"; done
106116
107117
- name: Skip if no libs changed
108118
shell: bash
@@ -113,6 +123,33 @@ jobs:
113123
exit 0
114124
fi
115125
126+
- name: Generate & print SHA256 sums
127+
shell: bash
128+
run: |
129+
set -euo pipefail
130+
calc() {
131+
if command -v sha256sum >/dev/null 2>&1; then
132+
sha256sum "$1" | awk '{print $1}'
133+
elif command -v shasum >/dev/null 2>&1; then
134+
shasum -a 256 "$1" | awk '{print $1}'
135+
elif command -v openssl >/dev/null 2>&1; then
136+
openssl dgst -sha256 "$1" | awk '{print $2}'
137+
else
138+
echo "No SHA-256 tool available" >&2; exit 1
139+
fi
140+
}
141+
: > libs/MANIFEST-SHA256.txt
142+
echo "SHA256 checksums:"
143+
shopt -s nullglob
144+
for f in libs/*/*.so libs/*/*.dylib libs/*/*.dll; do
145+
[ -f "$f" ] || continue
146+
sum="$(calc "$f")"
147+
rel="${f#libs/}"
148+
printf "%s %s\n" "$sum" "$rel" | tee -a libs/MANIFEST-SHA256.txt
149+
printf "%s\n" "$sum" > "${f}.sha256"
150+
done
151+
echo "Wrote libs/MANIFEST-SHA256.txt and per-file .sha256 sidecars."
152+
116153
- name: Create PR with updated libs
117154
uses: peter-evans/create-pull-request@v6
118155
with:

0 commit comments

Comments
 (0)