test
This commit is contained in:
@@ -115,62 +115,77 @@ jobs:
|
|||||||
IMAGE="$IMAGE_REGISTRY/$IMAGE_ORG/$IMAGE_REPO_MINECRAFT:${{ matrix.version }}"
|
IMAGE="$IMAGE_REGISTRY/$IMAGE_ORG/$IMAGE_REPO_MINECRAFT:${{ matrix.version }}"
|
||||||
docker buildx build --platform linux/amd64 --push -t "$IMAGE" "./${{ matrix.version }}"
|
docker buildx build --platform linux/amd64 --push -t "$IMAGE" "./${{ matrix.version }}"
|
||||||
|
|
||||||
generate-changelogs:
|
generate-changelogs:
|
||||||
needs: build-minecraft-images
|
needs: poll-debian-base-and-detect-changes
|
||||||
runs-on: doc-docker-build2
|
if: needs.poll-debian-base-and-detect-changes.outputs.digest_changed == 'true' || needs.poll-debian-base-and-detect-changes.outputs.versions_changed != ''
|
||||||
strategy:
|
runs-on: doc-docker-build2
|
||||||
matrix:
|
strategy:
|
||||||
version: [vanilla, testing, fabric]
|
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: Clone Minecraft repo (with retries)
|
||||||
run: |
|
run: |
|
||||||
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
GIT_CREDENTIAL="${{ secrets.GIT_TOKEN || secrets.GIT_PASSWORD }}"
|
||||||
for i in {1..5}; do
|
for i in {1..5}; do
|
||||||
git clone "https://${{ secrets.GIT_USERNAME }}:${GIT_CREDENTIAL}@gitea.fithwum.tech/fithwum/minecraft.git" upload-repo && break
|
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..."
|
echo "[WARN] Clone attempt $i failed. Retrying in 10s..."
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
if [ ! -d upload-repo ]; then
|
if [ ! -d upload-repo ]; then
|
||||||
echo "[ERROR] Failed to clone Minecraft repo after retries."
|
echo "[ERROR] Failed to clone Minecraft repo after retries."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update changelog
|
- name: Generate changelog
|
||||||
run: |
|
run: |
|
||||||
cd upload-repo
|
cd upload-repo
|
||||||
changelog="${{ matrix.version }}/CHANGES.md"
|
changelog="${{ matrix.version }}/CHANGES.md"
|
||||||
mkdir -p "$(dirname "$changelog")"
|
mkdir -p "$(dirname "$changelog")"
|
||||||
touch "$changelog"
|
touch "$changelog"
|
||||||
|
|
||||||
infofile="${{ matrix.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"
|
infofile="${{ matrix.version }}/build-info.json"
|
||||||
if [ -n "$last_commit" ]; then
|
last_commit=""
|
||||||
git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" | head -n 10 >> "$changelog"
|
if [ -f "$infofile" ]; then
|
||||||
else
|
last_commit=$(jq -r '.commit' "$infofile")
|
||||||
git log -n 10 --pretty=format:"- %s (%an)" >> "$changelog"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Commit and push changelog
|
echo -e "## $(date -u +'%Y-%m-%dT%H:%M:%SZ')\n" >> "$changelog"
|
||||||
run: |
|
|
||||||
cd upload-repo
|
if [ -n "$last_commit" ]; then
|
||||||
git config user.name "${{ secrets.GIT_USERNAME }}"
|
COMMITS=$(git log "${last_commit}..HEAD" --pretty=format:"- %s (%an)" || true)
|
||||||
git config user.email "${{ secrets.GIT_EMAIL }}"
|
fi
|
||||||
if git status --porcelain | grep .; then
|
|
||||||
git add "${{ matrix.version }}/CHANGES.md"
|
if [ -z "$COMMITS" ]; then
|
||||||
git commit -m "Update changelog for ${{ matrix.version }}" || true
|
echo "[INFO] No new commits since last build. Showing latest 5 instead."
|
||||||
git push
|
COMMITS=$(git log -n 5 --pretty=format:"- %s (%an)" || true)
|
||||||
else
|
fi
|
||||||
echo "[INFO] No changelog changes to commit."
|
|
||||||
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: |
|
||||||
|
cd upload-repo
|
||||||
|
git config user.name "${{ secrets.GIT_USERNAME }}"
|
||||||
|
git config user.email "${{ secrets.GIT_EMAIL }}"
|
||||||
|
if git status --porcelain | grep .; then
|
||||||
|
git add "${{ matrix.version }}/CHANGES.md"
|
||||||
|
git commit -m "Update changelog for ${{ matrix.version }}" || true
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "[INFO] No changelog changes to commit."
|
||||||
|
fi
|
||||||
|
|
||||||
generate-build-info:
|
generate-build-info:
|
||||||
needs: generate-changelogs
|
needs: generate-changelogs
|
||||||
|
|||||||
Reference in New Issue
Block a user