Skip to content
Merged
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
35 changes: 21 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

release:
needs: build
runs-on: ubuntu-latest
runs-on: windows-latest
permissions:
contents: write
steps:
Expand All @@ -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 <<EOF
Native Windows x64 build of [MarkText ${TAG}](https://github.com/marktext/marktext/releases/tag/${TAG})
(source commit marktext/marktext@${COMMIT}), compiled with
[NativeBoat ${NATIVEBOAT}](https://github.com/XTSoftwareLabs/nativeboat-release/releases/tag/${NATIVEBOAT}).
$ErrorActionPreference = 'Stop'
@"
Native Windows x64 build of [MarkText $env:TAG](https://github.com/marktext/marktext/releases/tag/$env:TAG)
(source commit marktext/marktext@$env:COMMIT), compiled with
[NativeBoat $env:NATIVEBOAT](https://github.com/XTSoftwareLabs/nativeboat-release/releases/tag/$env:NATIVEBOAT).

The executable runs without Chromium, WebView2 or Node.js. Download the
\`.exe\` to run it directly, or the \`.zip\` for the complete output folder.
EOF
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" > /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
}
Loading