Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading