chore: Sync MokoStandards v04.04 #110
291
.github/workflows/auto-update-sha.yml
vendored
291
.github/workflows/auto-update-sha.yml
vendored
@@ -1,147 +1,144 @@
|
|||||||
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# FILE INFORMATION
|
# FILE INFORMATION
|
||||||
# DEFGROUP: GitHub.Workflow
|
# DEFGROUP: GitHub.Workflow
|
||||||
# INGROUP: MokoCassiopeia.Automation
|
# INGROUP: MokoCassiopeia.Automation
|
||||||
# REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia
|
# REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia
|
||||||
# PATH: /.github/workflows/auto-update-sha.yml
|
# PATH: /.github/workflows/auto-update-sha.yml
|
||||||
# VERSION: 01.00.00
|
# VERSION: 01.00.00
|
||||||
# BRIEF: Automatically update SHA-256 hash in updates.xml after release
|
# BRIEF: Automatically update SHA-256 hash in updates.xml after release
|
||||||
# NOTE: Ensures updates.xml stays synchronized with release packages
|
# NOTE: Ensures updates.xml stays synchronized with release packages
|
||||||
|
|
||||||
name: Auto-Update SHA Hash
|
name: Auto-Update SHA Hash
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
description: 'Release tag to update SHA for (e.g., 03.08.03)'
|
description: 'Release tag to update SHA for (e.g., 03.08.03)'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-sha:
|
update-sha:
|
||||||
name: Update SHA-256 Hash in updates.xml
|
name: Update SHA-256 Hash in updates.xml
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: main
|
ref: main
|
||||||
|
|
||||||
- name: Get release tag
|
- name: Get release tag
|
||||||
id: tag
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||||
TAG="${{ inputs.tag }}"
|
TAG="${{ inputs.tag }}"
|
||||||
else
|
else
|
||||||
TAG="${{ github.event.release.tag_name }}"
|
TAG="${{ github.event.release.tag_name }}"
|
||||||
fi
|
fi
|
||||||
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
||||||
echo "Processing release: ${TAG}"
|
echo "Processing release: ${TAG}"
|
||||||
|
|
||||||
- name: Download release package
|
- name: Download release package
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.tag }}"
|
TAG="${{ steps.tag.outputs.tag }}"
|
||||||
PACKAGE_NAME="mokocassiopeia-src-${TAG}.zip"
|
PACKAGE_NAME="mokocassiopeia-src-${TAG}.zip"
|
||||||
DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${TAG}/${PACKAGE_NAME}"
|
DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${TAG}/${PACKAGE_NAME}"
|
||||||
|
|
||||||
echo "Downloading: ${DOWNLOAD_URL}"
|
echo "Downloading: ${DOWNLOAD_URL}"
|
||||||
curl -L -o "${PACKAGE_NAME}" "${DOWNLOAD_URL}"
|
curl -L -o "${PACKAGE_NAME}" "${DOWNLOAD_URL}"
|
||||||
|
|
||||||
if [ ! -f "${PACKAGE_NAME}" ]; then
|
if [ ! -f "${PACKAGE_NAME}" ]; then
|
||||||
echo "Error: Failed to download package"
|
echo "Error: Failed to download package"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
|
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Calculate SHA-256 hash
|
- name: Calculate SHA-256 hash
|
||||||
id: sha
|
id: sha
|
||||||
run: |
|
run: |
|
||||||
SHA256_HASH=$(sha256sum "${PACKAGE_NAME}" | cut -d' ' -f1)
|
SHA256_HASH=$(sha256sum "${PACKAGE_NAME}" | cut -d' ' -f1)
|
||||||
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: Update updates.xml
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.tag }}"
|
TAG="${{ steps.tag.outputs.tag }}"
|
||||||
SHA256="${{ steps.sha.outputs.sha256 }}"
|
SHA256="${{ steps.sha.outputs.sha256 }}"
|
||||||
DATE=$(date +%Y-%m-%d)
|
DATE=$(date +%Y-%m-%d)
|
||||||
|
|
||||||
# Update version
|
# Update version
|
||||||
sed -i "s|<version>.*</version>|<version>${TAG}</version>|" updates.xml
|
sed -i "s|<version>.*</version>|<version>${TAG}</version>|" updates.xml
|
||||||
|
|
||||||
# Update creation date
|
# Update creation date
|
||||||
sed -i "s|<creationDate>.*</creationDate>|<creationDate>${DATE}</creationDate>|" updates.xml
|
sed -i "s|<creationDate>.*</creationDate>|<creationDate>${DATE}</creationDate>|" updates.xml
|
||||||
|
|
||||||
# Update download URL
|
# Update download URL
|
||||||
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
|
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
|
||||||
|
|
||||||
# Update or add SHA-256 hash
|
# Update or add SHA-256 hash
|
||||||
if grep -q "<sha256>" updates.xml; then
|
if grep -q "<sha256>" updates.xml; then
|
||||||
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" updates.xml
|
sed -i "s|<sha256>.*</sha256>|<sha256>sha256:${SHA256}</sha256>|" updates.xml
|
||||||
else
|
else
|
||||||
# Add SHA-256 after downloadurl
|
# Add SHA-256 after downloadurl
|
||||||
sed -i "/<\/downloadurl>/a\ <sha256>sha256:${SHA256}<\/sha256>" updates.xml
|
sed -i "/<\/downloadurl>/a\ <sha256>sha256:${SHA256}<\/sha256>" updates.xml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Updated updates.xml with:"
|
echo "Updated updates.xml with:"
|
||||||
echo " Version: ${TAG}"
|
echo " Version: ${TAG}"
|
||||||
echo " Date: ${DATE}"
|
echo " Date: ${DATE}"
|
||||||
echo " SHA-256: ${SHA256}"
|
echo " SHA-256: ${SHA256}"
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: changes
|
id: changes
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet updates.xml; then
|
if git diff --quiet updates.xml; then
|
||||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||||
echo "No changes to updates.xml"
|
echo "No changes to updates.xml"
|
||||||
else
|
else
|
||||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||||
echo "Changes detected in updates.xml"
|
echo "Changes detected in updates.xml"
|
||||||
git diff updates.xml
|
git diff updates.xml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
if: steps.changes.outputs.has_changes == 'true'
|
if: steps.changes.outputs.has_changes == 'true'
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ steps.tag.outputs.tag }}"
|
TAG="${{ steps.tag.outputs.tag }}"
|
||||||
|
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
git add updates.xml
|
git add updates.xml
|
||||||
git commit -m "chore: Update SHA-256 hash for release ${TAG}
|
git commit -m "chore: Update SHA-256 hash for release ${TAG} - SHA: ${{ steps.sha.outputs.sha256 }}"
|
||||||
|
|
||||||
Auto-generated by auto-update-sha workflow
|
git push origin main
|
||||||
SHA-256: ${{ steps.sha.outputs.sha256 }}"
|
|
||||||
|
echo "Successfully updated updates.xml with SHA-256 hash for release ${TAG}"
|
||||||
git push origin main
|
|
||||||
|
- name: Summary
|
||||||
echo "Successfully updated updates.xml with SHA-256 hash for release ${TAG}"
|
if: steps.changes.outputs.has_changes == 'true'
|
||||||
|
run: |
|
||||||
- name: Summary
|
echo "### SHA-256 Hash Updated Successfully" >> $GITHUB_STEP_SUMMARY
|
||||||
if: steps.changes.outputs.has_changes == 'true'
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
run: |
|
echo "- Release: ${{ steps.tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "### SHA-256 Hash Updated Successfully" >> $GITHUB_STEP_SUMMARY
|
echo "- SHA-256: \`${{ steps.sha.outputs.sha256 }}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "- File: updates.xml" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "- Release: ${{ steps.tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "- SHA-256: \`${{ steps.sha.outputs.sha256 }}\`" >> $GITHUB_STEP_SUMMARY
|
echo "The Joomla update server will now provide the correct package hash." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "- File: updates.xml" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
- name: Summary (no changes)
|
||||||
echo "The Joomla update server will now provide the correct package hash." >> $GITHUB_STEP_SUMMARY
|
if: steps.changes.outputs.has_changes == 'false'
|
||||||
|
run: |
|
||||||
- name: Summary (no changes)
|
echo "### No Updates Needed" >> $GITHUB_STEP_SUMMARY
|
||||||
if: steps.changes.outputs.has_changes == 'false'
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
run: |
|
echo "updates.xml already contains the correct SHA-256 hash for release ${{ steps.tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "### No Updates Needed" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "updates.xml already contains the correct SHA-256 hash for release ${{ steps.tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|||||||
6
.github/workflows/repo_health.yml
vendored
6
.github/workflows/repo_health.yml
vendored
@@ -162,7 +162,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user