test
Some checks failed
Build, Upload RootFS, and Push Docker Images / push-archives-to-repo (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / build-and-push-docker-images (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / generate-changelogs (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / build-rootfs-archives (push) Has been cancelled
Some checks failed
Build, Upload RootFS, and Push Docker Images / push-archives-to-repo (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / build-and-push-docker-images (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / generate-changelogs (push) Has been cancelled
Build, Upload RootFS, and Push Docker Images / build-rootfs-archives (push) Has been cancelled
This commit is contained in:
@@ -161,3 +161,52 @@ jobs:
|
||||
else
|
||||
echo "[INFO] No changelog changes to commit."
|
||||
fi
|
||||
|
||||
generate-build-info:
|
||||
runs-on: docker-build
|
||||
needs: build-and-push-docker-images
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Clone upload repo
|
||||
run: git clone "${{ env.REPO_URL }}" upload-repo
|
||||
|
||||
- name: Generate build-info.json per version
|
||||
run: |
|
||||
cd upload-repo
|
||||
for version in buster bullseye bookworm docker-build; do
|
||||
echo "[INFO] Generating build-info.json for $version"
|
||||
mkdir -p "$version"
|
||||
infofile="$version/build-info.json"
|
||||
cat <<'EOF' > "$infofile"
|
||||
{
|
||||
"version": "__VERSION__",
|
||||
"commit": "__COMMIT__",
|
||||
"build_time": "__BUILD_TIME__",
|
||||
"image_tag": "__IMAGE_TAG__"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Now replace placeholders
|
||||
sed -i "s/__VERSION__/$version/" "$infofile"
|
||||
sed -i "s|__COMMIT__|$(git rev-parse HEAD)|" "$infofile"
|
||||
sed -i "s|__BUILD_TIME__|$(date -u +'%Y-%m-%dT%H:%M:%SZ')|" "$infofile"
|
||||
sed -i "s|__IMAGE_TAG__|gitea.fithwum.tech/fithwum/debian-base:$version|" "$infofile"
|
||||
done
|
||||
|
||||
|
||||
- name: Commit and push metadata if changed
|
||||
run: |
|
||||
cd upload-repo
|
||||
git config --global user.name "${{ env.GIT_USERNAME }}"
|
||||
git config --global user.email "${{ env.GIT_EMAIL }}"
|
||||
|
||||
if git status --porcelain | grep .; then
|
||||
git add */build-info.json
|
||||
git commit -m "Update build metadata on $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
git push
|
||||
else
|
||||
echo "[INFO] No metadata changes to commit."
|
||||
fi
|
||||
Reference in New Issue
Block a user