test
All checks were successful
Build and Push Minecraft Docker Images on Debian-base update / poll-debian-base-and-detect-changes (push) Successful in 9s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push fabric (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push vanilla (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / generate-changelogs (push) Successful in 5s
Build and Push Minecraft Docker Images on Debian-base update / generate-build-info (push) Successful in 7s
All checks were successful
Build and Push Minecraft Docker Images on Debian-base update / poll-debian-base-and-detect-changes (push) Successful in 9s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push testing (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push fabric (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / Build and Push vanilla (push) Successful in 10s
Build and Push Minecraft Docker Images on Debian-base update / generate-changelogs (push) Successful in 5s
Build and Push Minecraft Docker Images on Debian-base update / generate-build-info (push) Successful in 7s
This commit is contained in:
@@ -118,99 +118,82 @@ jobs:
|
|||||||
generate-changelogs:
|
generate-changelogs:
|
||||||
needs: build-minecraft-images
|
needs: build-minecraft-images
|
||||||
runs-on: doc-docker-build2
|
runs-on: doc-docker-build2
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
version: [vanilla, testing, fabric]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Clone Minecraft repo (with retries)
|
- name: Create temporary changelog workspace
|
||||||
|
run: mkdir -p changelogs
|
||||||
|
|
||||||
|
- name: Clone Minecraft repo
|
||||||
run: |
|
run: |
|
||||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||||
for i in {1..5}; do
|
git clone --depth=3 "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/minecraft.git" upload-repo
|
||||||
git clone "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/minecraft.git" upload-repo && break
|
|
||||||
echo "[WARN] Clone attempt $i failed. Retrying in 10s..."
|
- name: Generate changelogs
|
||||||
sleep 10
|
run: |
|
||||||
|
for version in $VERSIONS; do
|
||||||
|
echo "[INFO] Generating changelog for $version"
|
||||||
|
changelog="changelogs/$version/CHANGES.md"
|
||||||
|
mkdir -p "$(dirname "$changelog")"
|
||||||
|
touch "$changelog"
|
||||||
|
|
||||||
|
cd upload-repo
|
||||||
|
infofile="$version/build-info.json"
|
||||||
|
last_commit=""
|
||||||
|
if [ -f "$infofile" ]; then
|
||||||
|
last_commit=$(jq -r '.commit' "$infofile")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "## $(date -u +'%Y-%m-%dT%H:%M:%SZ')\n" > "../$changelog"
|
||||||
|
if [ -n "$last_commit" ]; then
|
||||||
|
COMMITS=$(git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" || true)
|
||||||
|
fi
|
||||||
|
if [ -z "$COMMITS" ]; then
|
||||||
|
echo "[INFO] No new commits since last build. Showing latest 5 instead."
|
||||||
|
COMMITS=$(git log -n 5 --pretty=format:"- %s (%an)" || true)
|
||||||
|
fi
|
||||||
|
echo "$COMMITS" >> "../$changelog"
|
||||||
|
cd ..
|
||||||
done
|
done
|
||||||
if [ ! -d upload-repo ]; then
|
|
||||||
echo "[ERROR] Failed to clone Minecraft repo after retries."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate changelog
|
- name: Copy changelogs into repo
|
||||||
run: |
|
run: |
|
||||||
cd upload-repo
|
for version in $VERSIONS; do
|
||||||
changelog="${{ matrix.version }}/CHANGES.md"
|
mkdir -p upload-repo/$version
|
||||||
mkdir -p "$(dirname "$changelog")"
|
cp changelogs/$version/CHANGES.md upload-repo/$version/
|
||||||
touch "$changelog"
|
done
|
||||||
|
|
||||||
infofile="${{ matrix.version }}/build-info.json"
|
- name: Commit and push changelogs
|
||||||
last_commit=""
|
|
||||||
if [ -f "$infofile" ]; then
|
|
||||||
last_commit=$(jq -r '.commit' "$infofile")
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "## $(date -u +'%Y-%m-%dT%H:%M:%SZ')\n" >> "$changelog"
|
|
||||||
|
|
||||||
if [ -n "$last_commit" ]; then
|
|
||||||
COMMITS=$(git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" || true)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$COMMITS" ]; then
|
|
||||||
echo "[INFO] No new commits since last build. Showing latest 5 instead."
|
|
||||||
COMMITS=$(git log -n 5 --pretty=format:"- %s (%an)" || true)
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$COMMITS" >> "$changelog"
|
|
||||||
|
|
||||||
- name: Show git status (debug)
|
|
||||||
run: |
|
|
||||||
cd upload-repo
|
|
||||||
echo "[DEBUG] Git status before commit:"
|
|
||||||
git status
|
|
||||||
echo "[DEBUG] Git diff:"
|
|
||||||
git diff
|
|
||||||
|
|
||||||
- name: Commit and push changelog
|
|
||||||
run: |
|
run: |
|
||||||
cd upload-repo
|
cd upload-repo
|
||||||
git config user.name "${{ secrets.GIT_USERNAME }}"
|
git config user.name "${{ secrets.GIT_USERNAME }}"
|
||||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||||
|
|
||||||
if git status --porcelain | grep .; then
|
if git status --porcelain | grep .; then
|
||||||
git add "${{ matrix.version }}/CHANGES.md"
|
git add */CHANGES.md
|
||||||
git commit -m "Update changelog for ${{ matrix.version }}" || true
|
git commit -m "Update changelogs on $(date -u +'%Y-%m-%dT%H:%M:%SZ')" --no-verify
|
||||||
git push
|
git push
|
||||||
else
|
else
|
||||||
echo "[INFO] No changelog changes to commit."
|
echo "[INFO] No changelog changes to commit."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
generate-build-info:
|
generate-build-info:
|
||||||
needs: build-minecraft-images
|
needs: generate-changelogs
|
||||||
runs-on: doc-docker-build2
|
runs-on: doc-docker-build2
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
version: [vanilla, testing, fabric]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Clone Minecraft repo (with retries)
|
- name: Prepare temporary build-info workspace
|
||||||
|
run: mkdir -p buildinfo
|
||||||
|
|
||||||
|
- name: Clone Minecraft repo
|
||||||
run: |
|
run: |
|
||||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||||
for i in {1..5}; do
|
git clone --depth=1 "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/minecraft.git" upload-repo
|
||||||
git clone "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/minecraft.git" upload-repo && break
|
|
||||||
echo "[WARN] Clone attempt $i failed. Retrying in 10s..."
|
|
||||||
sleep 10
|
|
||||||
done
|
|
||||||
if [ ! -d upload-repo ]; then
|
|
||||||
echo "[ERROR] Failed to clone Minecraft repo after retries."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Generate build-info.json
|
- name: Generate build-info files
|
||||||
run: |
|
run: |
|
||||||
human_size() {
|
human_size() {
|
||||||
local b=$1 d='' s=0 S=(B KB MB GB TB)
|
local b=$1 d='' s=0 S=(B KB MB GB TB)
|
||||||
@@ -220,52 +203,54 @@ jobs:
|
|||||||
printf "%s%s\n" "$b" "${S[$s]}"
|
printf "%s%s\n" "$b" "${S[$s]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
cd upload-repo
|
for version in $VERSIONS; do
|
||||||
mkdir -p "${{ matrix.version }}"
|
echo "[INFO] Generating build-info.json for $version"
|
||||||
infofile="${{ matrix.version }}/build-info.json"
|
image="${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_REPO_MINECRAFT}:$version"
|
||||||
image="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.IMAGE_REPO_MINECRAFT }}:${{ matrix.version }}"
|
infofile="buildinfo/$version/build-info.json"
|
||||||
|
mkdir -p "$(dirname "$infofile")"
|
||||||
|
|
||||||
if ! docker pull "$image"; then
|
if ! docker pull "$image"; then
|
||||||
echo "[WARN] Failed to pull $image — setting fields to unknown/0"
|
echo "[WARN] Failed to pull $image — setting fields to unknown/0"
|
||||||
digest="unknown"
|
digest="unknown"
|
||||||
size_bytes=0
|
size_bytes=0
|
||||||
else
|
else
|
||||||
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
digest=$(docker inspect --format='{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}unknown{{end}}' "$image" 2>/dev/null || echo "unknown")
|
||||||
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
size_bytes=$(docker image inspect "$image" --format='{{.Size}}' 2>/dev/null || echo "0")
|
||||||
size_bytes=${size_bytes//[^0-9]/}
|
size_bytes=${size_bytes//[^0-9]/}
|
||||||
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
if [[ -z "$size_bytes" ]]; then size_bytes=0; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
size_human=$(human_size "$size_bytes")
|
size_human=$(human_size "$size_bytes")
|
||||||
|
|
||||||
jq -n \
|
cd upload-repo
|
||||||
--arg version "${{ matrix.version }}" \
|
commit=$(git rev-parse HEAD)
|
||||||
--arg commit "$(git rev-parse HEAD)" \
|
cd ..
|
||||||
--arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
|
||||||
--arg image_tag "$image" \
|
|
||||||
--arg digest "$digest" \
|
|
||||||
--arg image_size "$size_human" \
|
|
||||||
--argjson image_size_bytes "$size_bytes" \
|
|
||||||
'{
|
|
||||||
version: $version,
|
|
||||||
commit: $commit,
|
|
||||||
build_time: $build_time,
|
|
||||||
image_tag: $image_tag,
|
|
||||||
digest: $digest,
|
|
||||||
image_size: $image_size,
|
|
||||||
image_size_bytes: $image_size_bytes
|
|
||||||
}' > "$infofile"
|
|
||||||
|
|
||||||
echo "[INFO] Generated $infofile:"
|
jq -n \
|
||||||
cat "$infofile"
|
--arg version "$version" \
|
||||||
|
--arg commit "$commit" \
|
||||||
|
--arg build_time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||||
|
--arg image_tag "$image" \
|
||||||
|
--arg digest "$digest" \
|
||||||
|
--arg image_size "$size_human" \
|
||||||
|
--argjson image_size_bytes "$size_bytes" \
|
||||||
|
'{
|
||||||
|
version: $version,
|
||||||
|
commit: $commit,
|
||||||
|
build_time: $build_time,
|
||||||
|
image_tag: $image_tag,
|
||||||
|
digest: $digest,
|
||||||
|
image_size: $image_size,
|
||||||
|
image_size_bytes: $image_size_bytes
|
||||||
|
}' > "$infofile"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Git status debug
|
- name: Copy build-info.json into repo
|
||||||
run: |
|
run: |
|
||||||
cd upload-repo
|
for version in $VERSIONS; do
|
||||||
echo "[DEBUG] Git status before commit:"
|
mkdir -p upload-repo/$version
|
||||||
git status
|
cp "buildinfo/$version/build-info.json" "upload-repo/$version/"
|
||||||
echo "[DEBUG] Git diff:"
|
done
|
||||||
git diff "${{ matrix.version }}/build-info.json" || true
|
|
||||||
|
|
||||||
- name: Commit and push build-info
|
- name: Commit and push build-info
|
||||||
run: |
|
run: |
|
||||||
@@ -274,14 +259,16 @@ jobs:
|
|||||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||||
|
|
||||||
if git status --porcelain | grep .; then
|
if git status --porcelain | grep .; then
|
||||||
git add "${{ matrix.version }}/build-info.json"
|
git add */build-info.json
|
||||||
git commit -m "Update build-info for ${{ matrix.version }} on $(date -u +'%Y-%m-%dT%H:%M:%SZ')" || true
|
git commit -m "Update build-info on $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
TAG="build-${{ matrix.version }}"
|
for version in $VERSIONS; do
|
||||||
git tag -d "$TAG" 2>/dev/null || true
|
TAG="build-$version"
|
||||||
git tag "$TAG"
|
git tag -d "$TAG" 2>/dev/null || true
|
||||||
git push origin "$TAG" --force
|
git tag "$TAG"
|
||||||
|
git push origin "$TAG" --force
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo "[INFO] No build-info changes to commit."
|
echo "[INFO] No build-info changes to commit."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user