From bcd3b51f8fc12864578cda957679aea628b4ac4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20M=C3=BCller?= Date: Fri, 22 May 2026 12:43:56 +0200 Subject: [PATCH 1/4] refactor workflow: createdraft release an publish on pushing version tag --- .github/workflows/release.yml | 52 ++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4b7042..5cabcc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,22 +1,32 @@ name: Release on: + push: + tags: + - 'v*.*.*' workflow_dispatch: - release: - types: - - published + inputs: + tag: + description: Release tag to publish, e.g. v1.0.0 + required: true + type: string permissions: contents: write jobs: electron-windows: - name: Build Windows installer and attach to release + name: Build Windows installer and attach to draft release runs-on: windows-latest + env: + RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 @@ -27,6 +37,40 @@ jobs: - name: Install dependencies run: npm ci + - name: Ensure draft GitHub release exists + shell: pwsh + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if ($env:RELEASE_TAG -notlike 'v*.*.*') { + throw "Release tag '$env:RELEASE_TAG' does not match the expected v*.*.* pattern." + } + + $packageVersion = (Get-Content package.json -Raw | ConvertFrom-Json).version + $tagVersion = $env:RELEASE_TAG -replace '^v', '' + + if ($packageVersion -ne $tagVersion) { + throw "package.json version '$packageVersion' does not match release tag '$env:RELEASE_TAG'." + } + + $releaseJson = gh release view $env:RELEASE_TAG --json isDraft,url 2>$null + + if ($LASTEXITCODE -eq 0) { + $release = $releaseJson | ConvertFrom-Json + + if (-not $release.isDraft) { + throw "Release '$env:RELEASE_TAG' already exists and is not a draft: $($release.url)" + } + + Write-Host "Draft release '$env:RELEASE_TAG' already exists: $($release.url)" + exit 0 + } + + gh release create $env:RELEASE_TAG ` + --draft ` + --title $env:RELEASE_TAG ` + --notes "Draft release for $env:RELEASE_TAG. Electron artifacts are uploaded by the release workflow." + - name: Build Electron Windows installer env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 135ea8ab2cfff5f718bdd04e403d24f260b54126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20M=C3=BCller?= Date: Fri, 22 May 2026 12:45:30 +0200 Subject: [PATCH 2/4] fix: use correct build version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cabcc0..135b106 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: throw "Release tag '$env:RELEASE_TAG' does not match the expected v*.*.* pattern." } - $packageVersion = (Get-Content package.json -Raw | ConvertFrom-Json).version + $packageVersion = (Get-Content package.json -Raw | ConvertFrom-Json).build.buildVersion $tagVersion = $env:RELEASE_TAG -replace '^v', '' if ($packageVersion -ne $tagVersion) { From 37f99cac679917788c3de59ee93e9b9a57944c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20M=C3=BCller?= Date: Fri, 22 May 2026 12:52:45 +0200 Subject: [PATCH 3/4] revert to package.json version string --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 135b106..5cabcc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,7 +46,7 @@ jobs: throw "Release tag '$env:RELEASE_TAG' does not match the expected v*.*.* pattern." } - $packageVersion = (Get-Content package.json -Raw | ConvertFrom-Json).build.buildVersion + $packageVersion = (Get-Content package.json -Raw | ConvertFrom-Json).version $tagVersion = $env:RELEASE_TAG -replace '^v', '' if ($packageVersion -ne $tagVersion) { From 29d28d96d87c61236f030217e2b892b502c2af79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20M=C3=BCller?= Date: Fri, 22 May 2026 13:27:26 +0200 Subject: [PATCH 4/4] remove duplicate push / pull_request trigger --- .github/workflows/test-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.yml index e1b0e4d..754188c 100644 --- a/.github/workflows/test-ci.yml +++ b/.github/workflows/test-ci.yml @@ -2,14 +2,13 @@ name: Test CI on: push: - pull_request: permissions: contents: read jobs: test: - name: npm run test-ci + name: run Angular test suite runs-on: ubuntu-latest steps: