From 9bf8cf94bab6e4bf4f5663e9f4c16da4f4d6d879 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:30:38 +0000 Subject: [PATCH 1/3] Initial plan From 8b9619214c5186961278e48ed66a8b28cbc36f7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:33:47 +0000 Subject: [PATCH 2/3] Add tag-driven GitHub release workflow with version check Agent-Logs-Url: https://github.com/precimed/container_template/sessions/bf6f23f2-709f-42de-a338-38064340da2c Co-authored-by: espenhgn <2492641+espenhgn@users.noreply.github.com> --- .github/workflows/release.yml | 48 ++++++++++++++++++++++++++++++++++ tests/test_release_workflow.py | 30 +++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 tests/test_release_workflow.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2dfb069 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Create release on tag + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Ensure tag commit is on main + run: | + git fetch origin main:refs/remotes/origin/main + git merge-base --is-ancestor "$GITHUB_SHA" "origin/main" + + - name: Check version matches tag + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + python - <<'PY' + import pathlib + import os + + expected = os.environ["TAG_VERSION"] + values = {} + exec(pathlib.Path("version/version.py").read_text(), None, values) + actual = values["VERSION"] + + if actual != expected: + raise SystemExit( + f"version/version.py VERSION={actual!r} " + f"does not match tag {expected!r}" + ) + PY + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + generate_release_notes: true diff --git a/tests/test_release_workflow.py b/tests/test_release_workflow.py new file mode 100644 index 0000000..422797d --- /dev/null +++ b/tests/test_release_workflow.py @@ -0,0 +1,30 @@ +from pathlib import Path + + +WORKFLOW_FILE = Path('.github/workflows/release.yml') + + +def test_release_workflow_exists_and_triggers_on_version_tags(): + content = WORKFLOW_FILE.read_text() + assert WORKFLOW_FILE.exists() + assert 'on:' in content + assert 'tags:' in content + assert '- "v*.*.*"' in content + + +def test_release_workflow_checks_tag_commit_is_on_main(): + content = WORKFLOW_FILE.read_text() + command = ( + 'git merge-base --is-ancestor "$GITHUB_SHA" ' + '"origin/main"' + ) + assert 'Ensure tag commit is on main' in content + assert command in content + + +def test_release_workflow_checks_version_and_generates_notes(): + content = WORKFLOW_FILE.read_text() + assert 'version/version.py' in content + assert 'VERSION' in content + assert 'softprops/action-gh-release@v2' in content + assert 'generate_release_notes: true' in content From 3df742a852b71dd23250d2db7a1611f7e3ffb6e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 21 Apr 2026 07:35:39 +0000 Subject: [PATCH 3/3] Fix release workflow test assertion order Agent-Logs-Url: https://github.com/precimed/container_template/sessions/bf6f23f2-709f-42de-a338-38064340da2c Co-authored-by: espenhgn <2492641+espenhgn@users.noreply.github.com> --- tests/test_release_workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_release_workflow.py b/tests/test_release_workflow.py index 422797d..f1956f6 100644 --- a/tests/test_release_workflow.py +++ b/tests/test_release_workflow.py @@ -5,8 +5,8 @@ def test_release_workflow_exists_and_triggers_on_version_tags(): - content = WORKFLOW_FILE.read_text() assert WORKFLOW_FILE.exists() + content = WORKFLOW_FILE.read_text() assert 'on:' in content assert 'tags:' in content assert '- "v*.*.*"' in content