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
53 changes: 12 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@ on:
push:
branches: [main]
pull_request:
workflow_dispatch:
workflow_call:
inputs:
marktext-ref:
description: MarkText tag to build from marktext/marktext
required: true
type: string
default: v0.20.0
nativeboat-version:
description: NativeBoat release tag, or latest
required: true
type: string
default: latest
outputs:
marktext-ref:
value: ${{ jobs.build.outputs.marktext-ref }}
marktext-commit:
value: ${{ jobs.build.outputs.marktext-commit }}
nativeboat-version:
value: ${{ jobs.build.outputs.nativeboat-version }}

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.workflow }}-build-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
MARKTEXT_REF: ${{ inputs.marktext-ref || 'v0.20.0' }}
Expand Down Expand Up @@ -65,7 +72,6 @@ jobs:
analyze: 'true'

- name: Package output
id: package
shell: pwsh
env:
OUTPUT: ${{ steps.nativeboat.outputs.output-path }}
Expand All @@ -86,38 +92,3 @@ jobs:
name: marktext-native-win-x64
path: release/
if-no-files-found: error

release:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: marktext-native-win-x64
path: release

- name: Publish release
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}).

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
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release native MarkText

on:
workflow_dispatch:
inputs:
marktext-ref:
description: MarkText tag to build from marktext/marktext; also the release tag
required: true
default: v0.20.0
nativeboat-version:
description: NativeBoat release tag, or latest
required: true
default: latest

permissions:
contents: read

concurrency:
group: release-${{ inputs.marktext-ref }}

jobs:
build:
uses: ./.github/workflows/build.yml
with:
marktext-ref: ${{ inputs.marktext-ref }}
nativeboat-version: ${{ inputs.nativeboat-version }}

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: marktext-native-win-x64
path: release

- name: Publish release
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}).

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
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ The [Build native MarkText](.github/workflows/build.yml) workflow:
dependencies,
3. compiles `packages/desktop` with the
[NativeBoat Build action](https://github.com/XTSoftwareLabs/nativeboat-action),
4. publishes the executable, a ZIP of the full output folder and
`SHA256SUMS.txt` to a release named after the MarkText tag.
4. uploads the executable, a ZIP of the full output folder and
`SHA256SUMS.txt` as a workflow artifact.

Pushes to `main` rebuild and update the release; pull requests build only. To
build another MarkText tag or NativeBoat version, run the workflow manually
from the Actions tab and set `marktext-ref` and `nativeboat-version`.
It runs on pushes to `main` and on pull requests, and publishes nothing.

## Releasing

Run the [Release native MarkText](.github/workflows/release.yml) workflow from
the Actions tab. Set `marktext-ref` to the MarkText tag to build and
`nativeboat-version` to a NativeBoat release tag or `latest`. It runs the build
above, then publishes its files to a release named after the MarkText tag.
Running it again for the same tag replaces that release's files.
Loading