From 33ea39d15a886dad350e7de8f6bf45a0bcbc7164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=20=D0=A0=D1=8B=D1=87=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 23 Oct 2026 15:26:15 +0000 Subject: [PATCH 1/3] fix: normalize Windows checksum line endings before release publication --- .github/workflows/desktop.yml | 2 + .github/workflows/finish-release.yml | 72 ++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/finish-release.yml diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 7eb3847..29dc217 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -119,6 +119,8 @@ jobs: assert os.environ['RELEASE_TAG'] == 'v' + version expected = [f'OpenWrtStudio_Setup_v{version}.exe', f'OpenWrtStudio_v{version}_Portable.zip', 'SHA256SUMS.txt'] assert all((Path('release') / name).stat().st_size > 0 for name in expected) + sums = Path('release/SHA256SUMS.txt') + sums.write_text(sums.read_text()) Path('release-notes.txt').write_text(Path('RELEASE_NOTES.md').read_text().split('\n---\n', 1)[0]) PYTHON (cd release && sha256sum -c SHA256SUMS.txt) diff --git a/.github/workflows/finish-release.yml b/.github/workflows/finish-release.yml new file mode 100644 index 0000000..cbffd0d --- /dev/null +++ b/.github/workflows/finish-release.yml @@ -0,0 +1,72 @@ +name: Publish verified Windows packages +on: + push: + branches: [codex/fix-release-checksums] + workflow_dispatch: + inputs: + tag: + required: true + type: string + run_id: + required: true + type: string +permissions: + contents: read +concurrency: + group: finish-windows-release-${{ inputs.tag || 'v2.5.21' }} + cancel-in-progress: false +jobs: + release: + runs-on: ubuntu-22.04 + permissions: + contents: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_TAG: ${{ inputs.tag || 'v2.5.21' }} + SOURCE_RUN: ${{ inputs.run_id || '39977654151' }} + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 + with: + ref: ${{ env.RELEASE_TAG }} + - name: Verify packages belong to the release tag and passed builds + run: | + set -euo pipefail + gh api "repos/$GITHUB_REPOSITORY/actions/runs/$SOURCE_RUN/jobs" --paginate > source-jobs.json + test "$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$SOURCE_RUN" --jq .head_sha)" = "$(git rev-parse HEAD)" + python3 - <<'PYTHON' + import json + jobs = json.load(open('source-jobs.json'))['jobs'] + for name in ['desktop', 'portable-core']: + assert any(job['name'] == name and job['conclusion'] == 'success' for job in jobs), name + PYTHON + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: OpenWrtStudio-win-x64 + path: release + run-id: ${{ env.SOURCE_RUN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Verify complete versioned packages + run: | + python3 - <<'PYTHON' + import os, re + import xml.etree.ElementTree as ET + from pathlib import Path + version = ET.parse('OpenWrtStudio.csproj').findtext('./PropertyGroup/Version') + assert os.environ['RELEASE_TAG'] == 'v' + version + expected = [f'OpenWrtStudio_Setup_v{version}.exe', f'OpenWrtStudio_v{version}_Portable.zip', 'SHA256SUMS.txt'] + assert all((Path('release') / name).stat().st_size > 0 for name in expected) + sums = Path('release/SHA256SUMS.txt') + sums.write_text(sums.read_text()) + Path('release-notes.txt').write_text(Path('RELEASE_NOTES.md').read_text().split('\n---\n', 1)[0]) + PYTHON + (cd release && sha256sum -c SHA256SUMS.txt) + - name: Publish complete release + run: | + set -euo pipefail + if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + echo 'Release already exists; refusing to overwrite it.' + exit 1 + fi + gh release create "$RELEASE_TAG" release/* --repo "$GITHUB_REPOSITORY" --verify-tag --title "OpenWrt Studio ${RELEASE_TAG#v}" --notes-file release-notes.txt --draft + test "$(gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets | length')" = 3 + gh release edit "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --draft=false --latest From 6aa737e0e832fd0ee8e43c1410b1a0830a2e3037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=20=D0=A0=D1=8B=D1=87=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 23 Oct 2026 15:26:44 +0000 Subject: [PATCH 2/3] ci: allow reading verified artifacts from the tag build --- .github/workflows/finish-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/finish-release.yml b/.github/workflows/finish-release.yml index cbffd0d..f1a5c65 100644 --- a/.github/workflows/finish-release.yml +++ b/.github/workflows/finish-release.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-22.04 permissions: contents: write + actions: read env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_TAG: ${{ inputs.tag || 'v2.5.21' }} From b119b2ecdf69dc90824d78f51ccd769c70bf4412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=20=D0=A0=D1=8B=D1=87=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Fri, 23 Oct 2026 15:28:57 +0000 Subject: [PATCH 3/3] ci: verify an already published release without replacing its assets --- .github/workflows/finish-release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/finish-release.yml b/.github/workflows/finish-release.yml index f1a5c65..2e00ff2 100644 --- a/.github/workflows/finish-release.yml +++ b/.github/workflows/finish-release.yml @@ -65,8 +65,21 @@ jobs: run: | set -euo pipefail if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then - echo 'Release already exists; refusing to overwrite it.' - exit 1 + gh api "repos/$GITHUB_REPOSITORY/releases/tags/$RELEASE_TAG" > existing-release.json + python3 - <<'PYTHON' + import hashlib, json + from pathlib import Path + existing = json.load(open('existing-release.json')) + assert not existing['draft'], 'An unfinished draft requires review' + assets = {asset['name']: asset for asset in existing['assets']} + local = list(Path('release').iterdir()) + assert set(assets) == {path.name for path in local} + for path in local: + assert assets[path.name]['size'] == path.stat().st_size + assert assets[path.name]['digest'] == 'sha256:' + hashlib.sha256(path.read_bytes()).hexdigest() + print('The published release already contains these exact verified files.') + PYTHON + exit 0 fi gh release create "$RELEASE_TAG" release/* --repo "$GITHUB_REPOSITORY" --verify-tag --title "OpenWrt Studio ${RELEASE_TAG#v}" --notes-file release-notes.txt --draft test "$(gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets | length')" = 3