mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-07-19 02:56:33 +00:00
chore(github-actions): improve changelog generation and git history fetch
This commit is contained in:
@@ -8,6 +8,21 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- mqtt-bridge-implementation-flex
|
||||
# Only rebuild firmware when something that affects the binaries changes.
|
||||
# Docs, the changelog, the changelog generator, and CI files do not change
|
||||
# firmware output — those are handled by sync-flasher-content.yml instead,
|
||||
# so editing them no longer produces new firmware hashes.
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'scripts/gen_changelog.py'
|
||||
- '.github/**'
|
||||
|
||||
# Serialize with sync-flasher-content.yml so the two workflows never push to the
|
||||
# flasher repo at the same time (shared group name across both workflows).
|
||||
concurrency:
|
||||
group: flasher-publish
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
# Version embedded in firmware filenames; must match the version key in the
|
||||
@@ -94,6 +109,9 @@ jobs:
|
||||
steps:
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# full history so scripts/gen_changelog.py can read the branch commit log
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download All Shard Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -146,6 +164,16 @@ jobs:
|
||||
"${{ steps.sha.outputs.short }}" \
|
||||
"$GITHUB_WORKSPACE/firmware-notes.html"
|
||||
|
||||
- name: Generate Changelog
|
||||
run: |
|
||||
# Append any new branch commits to the flasher's CHANGELOG.md. This is
|
||||
# append-only and idempotent: the hand-curated history and the hash
|
||||
# manifest already in flasher/CHANGELOG.md are preserved, and only
|
||||
# commits not yet listed are added. The flasher repo is the persistent
|
||||
# store of changelog state across builds; this checkout's git history
|
||||
# (fetch-depth: 0) is the source. changelog.html renders this file.
|
||||
python3 scripts/gen_changelog.py flasher/CHANGELOG.md
|
||||
|
||||
- name: Sync Docs into Flasher
|
||||
run: |
|
||||
# docs.html on the flasher site serves these raw .md files and renders
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
name: Sync Flasher Docs & Changelog
|
||||
|
||||
# Pushes the observer docs and the regenerated changelog to the flasher site
|
||||
# WITHOUT rebuilding firmware. Companion to build-observer-firmwares.yml:
|
||||
# - code changes -> build-observer-firmwares.yml (builds + syncs everything)
|
||||
# - doc / markdown edits -> this workflow (fast sync only, no firmware rebuild)
|
||||
# Keep the synced file list and trigger paths in step with the build workflow's
|
||||
# "Sync Docs into Flasher" step and with LOCAL_DOCS in flasher/docs.html.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- mqtt-bridge-implementation-flex
|
||||
paths:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'scripts/gen_changelog.py'
|
||||
|
||||
# Shared with build-observer-firmwares.yml so the two never push to the flasher
|
||||
# repo concurrently (a mixed code+docs commit can trigger both).
|
||||
concurrency:
|
||||
group: flasher-publish
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# full history so scripts/gen_changelog.py can read the branch commit log
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout Flasher Repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: agessaman/flasher.meshcore.io
|
||||
token: ${{ secrets.FLASHER_DISPATCH_TOKEN }}
|
||||
path: flasher
|
||||
|
||||
- name: Sync Docs into Flasher
|
||||
run: |
|
||||
# docs.html on the flasher site serves these raw .md files and renders
|
||||
# them client-side; keep this list in sync with LOCAL_DOCS in
|
||||
# flasher/docs.html and the build workflow's sync step.
|
||||
for f in MQTT_IMPLEMENTATION.md MQTT_SNMP.md ALERTS.md; do
|
||||
if [ -f "$f" ]; then
|
||||
cp -f "$f" "flasher/$f"
|
||||
echo "synced $f"
|
||||
else
|
||||
echo "WARNING: source doc $f not found" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Generate Changelog
|
||||
run: |
|
||||
# Append-only and idempotent; preserves the hand-curated history and
|
||||
# hash manifest already in flasher/CHANGELOG.md. changelog.html renders it.
|
||||
python3 scripts/gen_changelog.py flasher/CHANGELOG.md
|
||||
|
||||
- name: Commit & Push Flasher Content
|
||||
working-directory: flasher
|
||||
run: |
|
||||
if git diff --quiet; then
|
||||
echo "No flasher changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
git config user.name "meshcore-bot"
|
||||
git config user.email "noreply@gessaman.com"
|
||||
git commit -am "Sync docs & changelog from MeshCore ${GITHUB_SHA::7}"
|
||||
git push
|
||||
Reference in New Issue
Block a user