Skip to content

Commit a3366b0

Browse files
committed
fix(ci): name rolling release packages after the branch, not the version number
The install page (<https://www.mrdocs.com/docs/mrdocs/install.html>) reads the rolling-release assets via the GitHub API and picks one per platform by filename suffix. Because each develop push named its packages with the current project version (e.g. MrDocs-0.8.0-Linux.tar.gz), a version bump produced a new filename and left the previous version's files behind as stale assets on the develop-release and master-release rolling releases. The first-match lookup then happily returned the wrong (older) asset. Thus, for non-tag publishes, rename each package from MrDocs-<semver>-<platform>.<ext> to MrDocs-<ref-name>-<platform>.<ext> right before the upload step. Subsequent pushes to the same branch now produce identical filenames, which action-gh-release overwrites in place. Tag releases, which are immutable per version, keep their versioned filenames unchanged. The upload glob is relaxed from `MrDocs-*.*.*-*.*` to `MrDocs-*-*.*` to accommodate the branch-named form. A one-time manual cleanup of legacy versioned assets on the existing develop-release and master-release rolling releases is still required; subsequent CI runs will keep the state clean on their own.
1 parent 0246935 commit a3366b0

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,11 +1082,32 @@ jobs:
10821082
limit: 150
10831083
update-summary: ${{ runner.os == 'Linux' && 'true' || 'false' }}
10841084

1085+
# For non-tag publishes (the develop-release and master-release
1086+
# rolling releases), strip the project version out of the package
1087+
# filenames and insert the branch name instead. Subsequent pushes
1088+
# to the same branch then overwrite the existing GitHub-release
1089+
# assets cleanly; without this, a version bump would leave the
1090+
# previous version's files behind as stale assets. Tag releases
1091+
# keep their versioned filenames.
1092+
- name: Rebrand branch packages with the ref name
1093+
if: env.IS_PUBLISH_REF == 'true' && !startsWith(github.ref, 'refs/tags/')
1094+
run: |
1095+
set -euxo pipefail
1096+
cd packages
1097+
for f in MrDocs-*.*.*-*.*; do
1098+
[ -e "$f" ] || continue
1099+
new=$(echo "$f" | sed -E 's|^MrDocs-[0-9]+\.[0-9]+\.[0-9]+-|MrDocs-${{ github.ref_name }}-|')
1100+
mv -- "$f" "$new"
1101+
done
1102+
10851103
- name: Create GitHub Package Release
10861104
if: env.IS_PUBLISH_REF == 'true'
10871105
uses: softprops/action-gh-release@v2
10881106
with:
1089-
files: packages/MrDocs-*.*.*-*.*
1107+
# After the rebrand step, branch packages have the form
1108+
# MrDocs-<ref>-<platform>.<ext> (no semver), so the glob
1109+
# is broader than the historical MrDocs-*.*.*-*.*.
1110+
files: packages/MrDocs-*-*.*
10901111
fail_on_unmatched_files: true
10911112
name: ${{ github.ref_name || github.ref }}
10921113
tag_name: ${{ github.ref_name || github.ref }}${{ ((!startsWith(github.ref, 'refs/tags/')) && '-release') || '' }}

0 commit comments

Comments
 (0)