From 94224e2018fcb315c6f93cb3753f077841d2d230 Mon Sep 17 00:00:00 2001 From: Losminek <301412321+Losminek@users.noreply.github.com> Date: Thu, 26 Nov 2026 20:42:54 +0100 Subject: [PATCH] =?UTF-8?q?Release:=20dopln=C4=9Bn=C3=AD=20platformy=20sta?= =?UTF-8?q?v=C4=9Bt=20z=20commitu=20tagu=20(L30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Když release verze existuje a chybí v něm soubory jedné platformy, další push do main ji dostavěl z nové hlavy main, ne z commitu vydané verze. Checkout v jobu build teď bere tag z jobu prepare. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 4 +++- tests/test_release_workflow.py | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/test_release_workflow.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a9cae5..479fbf1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ # Sestavení a vydání NetMonitoru pro Windows, Linux a macOS (Intel i Apple Silicon). # Spuštění: # a) push na main se zvýšenou verzí v src/netmonitor/__init__.py => release v se založí sám -# (poznámky z CHANGELOG.md); pokud release té verze už existuje, nic se nevydává +# (poznámky z CHANGELOG.md); pokud release té verze už existuje, doplní se chybějící platformy z commitu tagu # b) vytvořením release / tagu "v*" na GitHubu # c) ručně: Actions → Build & Release → Run workflow → zadat existující tag (např. v1.0.1) # Každý build nahraje své soubory PŘÍMO do release – nepoužívá Actions artefakty @@ -94,6 +94,8 @@ jobs: steps: - uses: actions/checkout@v5 if: env.DO_BUILD == 'true' + with: + ref: refs/tags/${{ needs.prepare.outputs.tag }} - uses: actions/setup-python@v6 if: env.DO_BUILD == 'true' with: diff --git a/tests/test_release_workflow.py b/tests/test_release_workflow.py new file mode 100644 index 0000000..f9ce40e --- /dev/null +++ b/tests/test_release_workflow.py @@ -0,0 +1,22 @@ +"""Regrese L30: doplnění release musí stavět z commitu tagu vydané verze.""" +from pathlib import Path +import re + + +ROOT = Path(__file__).resolve().parent.parent + + +def test_build_checks_out_release_tag(): + workflow = (ROOT / ".github" / "workflows" / "release.yml").read_text(encoding="utf-8") + build = re.search(r"^ build:\n.*?(?=^ [\w-]+:|\Z)", workflow, re.M | re.S) + assert build is not None, "Chybí job build" + + checkout = re.search( + r"^ - uses: actions/checkout@v5\n(?P(?: .*\n)*)", + build.group(), + re.M, + ) + assert checkout is not None, "V jobu build chybí checkout" + assert " with:\n ref: refs/tags/${{ needs.prepare.outputs.tag }}\n" in checkout.group("options"), ( + "Checkout v jobu build musí použít tag z jobu prepare" + )