update workflow
All checks were successful
Build and Push Teamspeak Images on Base Image Update / check-for-changes (push) Successful in 14s
Build and Push Teamspeak Images on Base Image Update / build-alpine (push) Successful in 6s
Build and Push Teamspeak Images on Base Image Update / build-basic (push) Successful in 7s
Build and Push Teamspeak Images on Base Image Update / build-debian (push) Successful in 17s
Build and Push Teamspeak Images on Base Image Update / generate-build-info (push) Successful in 4s

This commit is contained in:
2025-07-13 06:01:33 -07:00
parent 6642794182
commit 6abc278449

View File

@@ -156,71 +156,6 @@ jobs:
echo "[INFO] Building $IMAGE"
docker buildx build --platform linux/amd64 --push -t "$IMAGE" --metadata-file "$METAFILE2" ./basic
generate-changelogs:
needs: check-for-changes
if: |
needs.check-for-changes.outputs.should_build_alpine == 'true' ||
needs.check-for-changes.outputs.should_build_debian == 'true' ||
needs.check-for-changes.outputs.should_build_basic == 'true'
runs-on: vm-docker-build2
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate changelogs only for updated variants
run: |
versions=()
if [[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]]; then
versions+=("alpine")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]]; then
versions+=("debian")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]]; then
versions+=("basic")
fi
for version in "${versions[@]}"; do
echo "[INFO] Updating changelog for $version"
changelog="$version/CHANGES.md"
mkdir -p "$(dirname "$changelog")"
touch "$changelog"
infofile="$version/build-info.json"
last_commit=""
if [ -f "$infofile" ]; then
last_commit=$(jq -r '.commit' "$infofile")
fi
# Check if last_commit exists in history, fallback to last 10 commits if not
if ! git cat-file -e "${last_commit}^{commit}" 2>/dev/null; then
echo "[WARN] Last commit from build-info.json not found, using last 10 commits"
last_commit=""
fi
echo -e "\n## $(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$changelog"
if [ -n "$last_commit" ]; then
git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" --no-merges --invert-grep --grep="Update changelogs on" | head -n 10 >> "$changelog"
else
git log -n 10 --pretty=format:"- %s (%an)" --no-merges --invert-grep --grep="Update changelogs on" >> "$changelog"
fi
done
- name: Commit and push changelogs
run: |
git config user.name "${{ secrets.GIT_USERNAME }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
if git status --porcelain | grep .; then
git add */CHANGES.md
git commit -m "Update changelogs on $(date -u +'%Y-%m-%dT%H:%M:%SZ')" --no-verify
git push
else
echo "[INFO] No changelog changes to commit."
fi
generate-build-info:
needs:
- build-alpine
@@ -347,3 +282,68 @@ jobs:
ls -l basic/build-info.json || echo "❌ build-info not written"
cat basic/build-info.json || echo "❌ empty build-info"
generate-changelogs:
needs: generate-build-info
if: |
needs.check-for-changes.outputs.should_build_alpine == 'true' ||
needs.check-for-changes.outputs.should_build_debian == 'true' ||
needs.check-for-changes.outputs.should_build_basic == 'true'
runs-on: vm-docker-build2
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate changelogs only for updated variants
run: |
versions=()
if [[ "${{ needs.check-for-changes.outputs.should_build_alpine }}" == "true" ]]; then
versions+=("alpine")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_debian }}" == "true" ]]; then
versions+=("debian")
fi
if [[ "${{ needs.check-for-changes.outputs.should_build_basic }}" == "true" ]]; then
versions+=("basic")
fi
for version in "${versions[@]}"; do
echo "[INFO] Updating changelog for $version"
changelog="$version/CHANGES.md"
mkdir -p "$(dirname "$changelog")"
touch "$changelog"
infofile="$version/build-info.json"
last_commit=""
if [ -f "$infofile" ]; then
last_commit=$(jq -r '.commit' "$infofile")
fi
# Check if last_commit exists in history, fallback to last 10 commits if not
if ! git cat-file -e "${last_commit}^{commit}" 2>/dev/null; then
echo "[WARN] Last commit from build-info.json not found, using last 10 commits"
last_commit=""
fi
echo -e "\n## $(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$changelog"
if [ -n "$last_commit" ]; then
git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" --no-merges --invert-grep --grep="Update changelogs on" | head -n 10 >> "$changelog"
else
git log -n 10 --pretty=format:"- %s (%an)" --no-merges --invert-grep --grep="Update changelogs on" >> "$changelog"
fi
done
- name: Commit and push changelogs
run: |
git config user.name "${{ secrets.GIT_USERNAME }}"
git config user.email "${{ secrets.GIT_EMAIL }}"
if git status --porcelain | grep .; then
git add */CHANGES.md
git commit -m "Update changelogs on $(date -u +'%Y-%m-%dT%H:%M:%SZ')" --no-verify
git push
else
echo "[INFO] No changelog changes to commit."
fi