From 72a7abd482a19d2c2d207523839fb558a97d8208 Mon Sep 17 00:00:00 2001 From: tanglearncode Date: Wed, 21 Oct 2026 11:21:33 +0800 Subject: [PATCH] Publish releases from a Windows runner NativeBoat only supports Windows, so the release job now runs on windows-latest with PowerShell like the build job. --- .github/workflows/release.yml | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 971828b..85a19ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: release: needs: build - runs-on: ubuntu-latest + runs-on: windows-latest permissions: contents: write steps: @@ -37,24 +37,31 @@ jobs: path: release - name: Publish release + shell: pwsh env: GH_TOKEN: ${{ github.token }} TAG: ${{ needs.build.outputs.marktext-ref }} NATIVEBOAT: ${{ needs.build.outputs.nativeboat-version }} COMMIT: ${{ needs.build.outputs.marktext-commit }} run: | - cat > notes.md < /dev/null 2>&1; then - gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file notes.md - gh release upload "$TAG" release/* --repo "$GITHUB_REPOSITORY" --clobber - else - gh release create "$TAG" release/* --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \ - --title "MarkText ${TAG} (native Windows)" --notes-file notes.md - fi + ``.exe`` to run it directly, or the ``.zip`` for the complete output folder. + "@ | Set-Content -Encoding utf8NoBOM notes.md + $files = (Get-ChildItem release -File).FullName + gh release view $env:TAG --repo $env:GITHUB_REPOSITORY *> $null + $exists = $LASTEXITCODE -eq 0 + # Fail on any gh error from here on. + $PSNativeCommandUseErrorActionPreference = $true + if ($exists) { + gh release edit $env:TAG --repo $env:GITHUB_REPOSITORY --notes-file notes.md + gh release upload $env:TAG @files --repo $env:GITHUB_REPOSITORY --clobber + } else { + gh release create $env:TAG @files --repo $env:GITHUB_REPOSITORY --target $env:GITHUB_SHA ` + --title "MarkText $env:TAG (native Windows)" --notes-file notes.md + }