Skip to content

Commit 109a02d

Browse files
therealalephclaude
andcommitted
ci: refresh in-repo releases/ folder on each release tag
Resume the practice (dropped after v1.1.0) of committing prebuilt binaries to the repo's releases/ folder. Iranian users behind state network filtering frequently can't reach the GitHub Releases page (/releases/tag/...) but CAN reach the static source tree via Code → Download ZIP — that pulls the in-repo releases/ folder along with the source. Telegram channel feedback explicitly requested this be resumed. The new commit-releases job: 1. Runs after release+build+android succeed. 2. Wipes existing binary artifacts from releases/ (.apk, .tar.gz, .zip) but preserves README.md and .gitattributes. 3. Copies all desktop archives (which already have stable platform-suffixed names like mhrv-rs-linux-amd64.tar.gz). 4. Copies all per-ABI Android APKs (so users on slow connections can grab the ~37 MB arm64-v8a APK instead of the ~110 MB universal). 5. sed-updates the "Current version" line and APK filename refs in releases/README.md (both English and Persian copies). 6. Commits as github-actions[bot] and pushes to main. The GitHub Release page itself keeps the canonical versioned artifacts as before — this in-repo folder is the fallback for users who can't reach that URL. Tag protection rules don't apply to refs/heads/main so the push isn't gated. release-drafter.yml triggers on push-to-main but only updates the next-release draft, no cycle risk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 124d0c3 commit 109a02d

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,113 @@ jobs:
650650
append_body: true
651651
generate_release_notes: true
652652

653+
# Refresh the in-repo `releases/` folder with the latest pre-built
654+
# artifacts so users behind GitHub-Releases-page filtering (the IR
655+
# state network filters the dynamic /releases/ URL but not the static
656+
# `Code → Download ZIP` of the source tree) can still download.
657+
# Practice was started pre-v1.1.0, dropped, then resumed at user
658+
# request after a Telegram-channel suggestion: "فقط داخل پوشه ریلیز
659+
# پروژه اپلود بکن — مشکل دانلود حل میشه — راحت میشه از گیتهاب دانلود
660+
# کرد." The folder holds ONLY the latest version (replace, not
661+
# archive); each tag refresh overwrites the previous artifacts. The
662+
# existing release-page workflow keeps versioned artifacts behind
663+
# `https://github.com/.../releases/tag/v...` for users who can reach
664+
# that URL — this in-repo folder is the fallback for users who can't.
665+
commit-releases:
666+
needs: [build, android, release]
667+
runs-on: ubuntu-latest
668+
permissions:
669+
contents: write
670+
steps:
671+
# Always check out main, not the tag — we're committing back to
672+
# the moving branch. fetch-depth 0 so `git push origin HEAD:main`
673+
# has the lineage to fast-forward.
674+
- uses: actions/checkout@v4
675+
with:
676+
ref: main
677+
fetch-depth: 0
678+
679+
- uses: actions/download-artifact@v4
680+
with:
681+
path: artifacts
682+
merge-multiple: true
683+
684+
- name: Refresh releases/ folder
685+
run: |
686+
set -euo pipefail
687+
VER="${{ inputs.version || github.ref_name }}"
688+
VER="${VER#v}"
689+
690+
mkdir -p releases
691+
692+
# Wipe old binary artifacts (.apk, .tar.gz, .zip) but keep
693+
# README.md and .gitattributes — those are folder-level docs
694+
# that stay constant across versions and shouldn't be
695+
# regenerated on every release.
696+
find releases -maxdepth 1 -type f \
697+
\( -name '*.apk' -o -name '*.tar.gz' -o -name '*.zip' \) \
698+
-delete
699+
700+
# Copy desktop archives. Their names already include the
701+
# platform identifier (mhrv-rs-linux-amd64.tar.gz, etc.) and
702+
# are version-stable — no rename needed.
703+
for f in artifacts/*.tar.gz artifacts/*.zip; do
704+
[ -f "$f" ] || continue
705+
cp "$f" "releases/$(basename "$f")"
706+
done
707+
708+
# Android APKs come with the version baked into the name
709+
# (mhrv-rs-android-universal-v1.7.5.apk). Copy all of them so
710+
# users on slow connections can grab a per-ABI APK (~37 MB)
711+
# instead of the universal (~110 MB).
712+
for f in artifacts/mhrv-rs-android-*.apk; do
713+
[ -f "$f" ] || continue
714+
cp "$f" "releases/$(basename "$f")"
715+
done
716+
717+
# Update the "Current version" line in releases/README.md
718+
# (both English and Persian copies) and APK filename refs so
719+
# the doc stays accurate. `sed -i` BSD/GNU compatibility is
720+
# handled by passing an empty extension explicitly — runner
721+
# is Linux so `-i` alone works, but the empty-string form
722+
# also works on macOS for anyone running this locally.
723+
if [ -f releases/README.md ]; then
724+
sed -i.bak \
725+
-e "s/Current version: \*\*v[0-9][0-9.]*\*\*/Current version: **v${VER}**/" \
726+
-e "s/نسخهٔ فعلی: \*\*v[0-9][0-9.]*\*\*/نسخهٔ فعلی: **v${VER}**/" \
727+
-e "s/mhrv-rs-android-universal-v[0-9][0-9.]*\.apk/mhrv-rs-android-universal-v${VER}.apk/g" \
728+
releases/README.md
729+
rm -f releases/README.md.bak
730+
fi
731+
732+
echo "--- releases/ contents after refresh ---"
733+
ls -la releases/
734+
735+
- name: Commit + push to main
736+
run: |
737+
set -euo pipefail
738+
VER="${{ inputs.version || github.ref_name }}"
739+
VER="${VER#v}"
740+
741+
git config user.name "github-actions[bot]"
742+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
743+
744+
git add releases
745+
if git diff --cached --quiet; then
746+
echo "No releases/ changes to commit (artifacts identical to current HEAD?)."
747+
exit 0
748+
fi
749+
750+
git commit -m "chore(releases): refresh prebuilt binaries for v${VER}" \
751+
-m "Auto-committed by release workflow so users behind GitHub-Releases-page filtering can download via the in-repo releases/ folder. The GitHub Release page itself still has the canonical versioned artifacts; this folder is the fallback path for users who can only reach the static source tree (Code → Download ZIP)."
752+
753+
# Push to main. The release workflow runs on the tag commit,
754+
# which is reachable from main as a fast-forward — push is
755+
# straightforward, no force needed. Tag protection rules
756+
# apply to refs/tags/* not refs/heads/main, so this push
757+
# isn't gated by the same protection.
758+
git push origin HEAD:main
759+
653760
# Notify the Persian-speaking Telegram channel with the CI-built
654761
# Android APK + its sha256 + the per-version changelog from
655762
# `docs/changelog/v<tag>.md`.

0 commit comments

Comments
 (0)