fix: per-channel updates.xml targeting + release on all patches
Some checks failed
Repo Health / Access control (push) Successful in 1s
Auto-Update SHA Hash / Update SHA-256 Hash in updates.xml (release) Failing after 4s
Repo Health / Release configuration (push) Failing after 4s
Repo Health / Scripts governance (push) Successful in 4s
Repo Health / Repository health (push) Failing after 4s
Some checks failed
Repo Health / Access control (push) Successful in 1s
Auto-Update SHA Hash / Update SHA-256 Hash in updates.xml (release) Failing after 4s
Repo Health / Release configuration (push) Failing after 4s
Repo Health / Scripts governance (push) Successful in 4s
Repo Health / Repository health (push) Failing after 4s
- auto-update-sha: replace blanket sed with Python targeting only the matching stability channel, fix sha256: prefix to raw hex - auto-release: remove patch 00 skip, all patches now release Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
.github/workflows/auto-release.yml
vendored
20
.github/workflows/auto-release.yml
vendored
@@ -26,7 +26,7 @@
|
|||||||
# | 8. Build ZIP, upload asset, write SHA-256 to updates.xml |
|
# | 8. Build ZIP, upload asset, write SHA-256 to updates.xml |
|
||||||
# | |
|
# | |
|
||||||
# | Every version change: archives main -> version/XX.YY branch |
|
# | Every version change: archives main -> version/XX.YY branch |
|
||||||
# | Patch 00 = development (no release). First release = patch 01. |
|
# | All patches release (including 00). Patch 00/01 = full pipeline. |
|
||||||
# | First release only (patch == 01): |
|
# | First release only (patch == 01): |
|
||||||
# | 7b. Create new GitHub Release |
|
# | 7b. Create new GitHub Release |
|
||||||
# | |
|
# | |
|
||||||
@@ -100,19 +100,13 @@ jobs:
|
|||||||
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
|
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
|
||||||
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
|
echo "major=$MAJOR" >> "$GITHUB_OUTPUT"
|
||||||
echo "release_tag=v${MAJOR}" >> "$GITHUB_OUTPUT"
|
echo "release_tag=v${MAJOR}" >> "$GITHUB_OUTPUT"
|
||||||
if [ "$PATCH" = "00" ]; then
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
if [ "$PATCH" = "00" ] || [ "$PATCH" = "01" ]; then
|
||||||
echo "is_minor=false" >> "$GITHUB_OUTPUT"
|
echo "is_minor=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "Version: $VERSION (patch 00 = development — skipping release)"
|
echo "Version: $VERSION (first release for this minor — full pipeline)"
|
||||||
else
|
else
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
echo "is_minor=false" >> "$GITHUB_OUTPUT"
|
||||||
if [ "$PATCH" = "01" ]; then
|
echo "Version: $VERSION (patch — platform version + badges only)"
|
||||||
echo "is_minor=true" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "Version: $VERSION (first release — full pipeline)"
|
|
||||||
else
|
|
||||||
echo "is_minor=false" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "Version: $VERSION (patch — platform version + badges only)"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Check if already released
|
- name: Check if already released
|
||||||
|
|||||||
79
.github/workflows/auto-update-sha.yml
vendored
79
.github/workflows/auto-update-sha.yml
vendored
@@ -70,33 +70,60 @@ jobs:
|
|||||||
echo "sha256=${SHA256_HASH}" >> $GITHUB_OUTPUT
|
echo "sha256=${SHA256_HASH}" >> $GITHUB_OUTPUT
|
||||||
echo "SHA-256 Hash: ${SHA256_HASH}"
|
echo "SHA-256 Hash: ${SHA256_HASH}"
|
||||||
|
|
||||||
- name: Update updates.xml
|
- name: Determine stability channel
|
||||||
|
id: channel
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.tag }}"
|
TAG="${{ steps.tag.outputs.tag }}"
|
||||||
SHA256="${{ steps.sha.outputs.sha256 }}"
|
case "$TAG" in
|
||||||
|
development) STABILITY="development" ;;
|
||||||
|
alpha) STABILITY="alpha" ;;
|
||||||
|
beta) STABILITY="beta" ;;
|
||||||
|
release-candidate) STABILITY="rc" ;;
|
||||||
|
*) STABILITY="stable" ;;
|
||||||
|
esac
|
||||||
|
echo "stability=${STABILITY}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Channel: ${STABILITY}"
|
||||||
|
|
||||||
|
- name: Update updates.xml (targeted channel only)
|
||||||
|
env:
|
||||||
|
PY_TAG: ${{ steps.tag.outputs.tag }}
|
||||||
|
PY_SHA: ${{ steps.sha.outputs.sha256 }}
|
||||||
|
PY_STABILITY: ${{ steps.channel.outputs.stability }}
|
||||||
|
run: |
|
||||||
DATE=$(date +%Y-%m-%d)
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
export PY_DATE="$DATE"
|
||||||
# Update version
|
|
||||||
sed -i "s|<version>.*</version>|<version>${TAG}</version>|" updates.xml
|
python3 << 'PYEOF'
|
||||||
|
import re, os
|
||||||
# Update creation date
|
|
||||||
sed -i "s|<creationDate>.*</creationDate>|<creationDate>${DATE}</creationDate>|" updates.xml
|
tag = os.environ["PY_TAG"]
|
||||||
|
sha256 = os.environ["PY_SHA"]
|
||||||
# Update download URL
|
date = os.environ["PY_DATE"]
|
||||||
sed -i "s|<downloadurl type='full' format='zip'>.*</downloadurl>|<downloadurl type='full' format='zip'>https://github.com/${{ github.repository }}/releases/download/${TAG}/mokocassiopeia-src-${TAG}.zip</downloadurl>|" updates.xml
|
stability = os.environ["PY_STABILITY"]
|
||||||
|
|
||||||
# Update or add SHA-256 hash
|
with open("updates.xml") as f:
|
||||||
if grep -q "<sha256>" updates.xml; then
|
content = f.read()
|
||||||
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" updates.xml
|
|
||||||
else
|
pattern = r"(<update>(?:(?!</update>).)*?<tag>" + re.escape(stability) + r"</tag>.*?</update>)"
|
||||||
# Add SHA-256 after downloadurl
|
match = re.search(pattern, content, re.DOTALL)
|
||||||
sed -i "/<\/downloadurl>/a\ <sha256>sha256:${SHA256}<\/sha256>" updates.xml
|
|
||||||
fi
|
if not match:
|
||||||
|
print(f"No <update> block for <tag>{stability}</tag> — skipping")
|
||||||
echo "Updated updates.xml with:"
|
exit(0)
|
||||||
echo " Version: ${TAG}"
|
|
||||||
echo " Date: ${DATE}"
|
block = match.group(1)
|
||||||
echo " SHA-256: ${SHA256}"
|
original = block
|
||||||
|
|
||||||
|
block = re.sub(r"<sha256>[^<]*</sha256>", f"<sha256>{sha256}</sha256>", block)
|
||||||
|
block = re.sub(r"<creationDate>[^<]*</creationDate>", f"<creationDate>{date}</creationDate>", block)
|
||||||
|
|
||||||
|
content = content.replace(original, block)
|
||||||
|
|
||||||
|
with open("updates.xml", "w") as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print(f"Updated {stability} channel: sha={sha256[:16]}..., date={date}")
|
||||||
|
PYEOF
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: changes
|
id: changes
|
||||||
@@ -118,8 +145,10 @@ jobs:
|
|||||||
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
git config --local user.name "gitea-actions[bot]"
|
git config --local user.name "gitea-actions[bot]"
|
||||||
|
|
||||||
|
STABILITY="${{ steps.channel.outputs.stability }}"
|
||||||
git add updates.xml
|
git add updates.xml
|
||||||
git commit -m "chore: Update SHA-256 hash for release ${TAG} - SHA: ${{ steps.sha.outputs.sha256 }}"
|
git commit -m "chore: update ${STABILITY} SHA-256 for ${TAG} [skip ci]" \
|
||||||
|
--author="gitea-actions[bot] <gitea-actions[bot]@mokoconsulting.tech>"
|
||||||
|
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user