MyGit

pengx17/logseq-publish

Fork: 36 Star: 357 (更新于 2024-11-16 11:25:34)

license: MIT

Language: JavaScript .

Archived. Please check https://github.com/logseq/publish-spa instead

最后发布版本: 0.1.8 ( 2023-03-31 10:38:11)

GitHub网址

Note: Logseq team has published its official solution. As a result, I will archive mine here. Thanks for your supports thus far!

Logseq Publish Action

Publish your Logseq graph with a GitHub Action. ✨

This action is the missing piece for achieving a complete CD workflow for your public Logseq graph.

Example Logseq Graphs Published with this Action

Usage

A video to walk through.

Firstly, add this step to your GitHub workflow. You can refer to My Example Graph's workflows/main.yml as an example.

steps:
  - uses: actions/checkout@v2
  - name: Logseq Publish 🚩
    uses: pengx17/logseq-publish@v0.1
    with:
      version: latest
  - name: add a nojekyll file # to make sure asset paths are correctly identified
    run: touch $GITHUB_WORKSPACE/www/.nojekyll
  - name: Deploy 🚀
    uses: JamesIves/github-pages-deploy-action@4
    with:
      branch: gh-pages # The branch the action should deploy to.
      folder: www # The folder the action should deploy.
      clean: true

Whenever you push changes to your GitHub repo, your graph will be published to the gh-pages branch. A few minutes later, your GitHub Pages will get updated.

All options

  • src: Publish graph src directory. Defaults to `` (empty string, root repo directory).
  • dest: Publish destination directory. Defaults to www.
  • trace: Whether to generate and publish trace file for debugging. This trace file will be uploaded as an artifact to the run. Defaults to true.
  • theme: Selected theme. Defaults to light.
  • version: the Logseq App version. Note: only a few of the versions are available and may not work any longer.

How it works

Here is a document about the story behind this action.

TLDR., this action will start Logseq desktop App in a Docker container, automate it by Playwright and finally load & publish the graph.

Since most of the work is done in a prepared Docker container, you can refer to action.yml and adapt it in other places without the need for GitHub actions.

Hint: you can checkout the trace file in the action artifacts and view it in the Playwright trace viewer to see what's going on in the action.

https://user-images.githubusercontent.com/584378/163351229-ba281c08-c29d-4cf5-8223-337bf80b8726.mp4

Alternate usage examples

  • One-liner Powershell call with only Docker installed as prerequisite. Below assumes that your folder workfolder has "KnowledgeGraph" for the graph, and "HTMLOutput" for the output. Container will be created and discarded on the fly.
PS C:\> docker run -d -i  `
	     --name LogSeqPublishContainer  `
	     --rm `
	     -v D:\WorfklowScripts\PublishLogseqExport\graph:/home/logseq/graph  `
	     -w /home/logseq  `
	     ghcr.io/pengx17/logseq-base:master  `
	     bash -c "xvfb-run node /home/logseq/graph/publish.mjs -p /home/logseq/graph/KnowledgeGraph -t /home/logseq/graph/build_trace.txt -o /home/logseq/graph/HTMLOutput > /home/logseq/graph/build.log"

Local development

  • clone https://github.com/logseq/logseq.git & https://github.com/pengx17/logseq-publish.git
  • build logseq app
    • cd into logseq src root
    • change "name": "Logseq" in resources/package.json to "name": "something-else"
      • run yarn && yarn release
    • cd into static and run yarn && yarn rebuild:better-sqlite3
  • copy logseq static into logseq-publish/public/static
    • in logseq-publish root, run
      • mkdir public
      • cp -r ../logseq/static ./public/static (assuming logseq and logseq-publish is at the same folder)
  • install logseq-publish deps
    • makes sure you have pnpm & Node > 16 installed
    • run pnpm i
  • now you should be able to use node publish.mjs to run the script

Hints:

最近版本更新:(数据更新于 2024-10-15 19:01:06)

2023-03-31 10:38:11 0.1.8

2022-10-25 22:51:15 0.1.7

2022-03-08 11:40:55 v0.1

2022-03-08 11:36:27 0.1.6

2022-01-19 23:37:31 0.1.5

2022-01-16 22:51:41 0.1.3

主题(topics):

logseq, publish

pengx17/logseq-publish同语言 JavaScript最近更新仓库

2024-11-21 23:03:24 bia-pain-bache/BPB-Worker-Panel

2024-11-21 22:46:48 MHSanaei/3x-ui

2024-11-21 07:00:59 nodejs/node

2024-11-21 00:49:46 FortAwesome/Font-Awesome

2024-11-18 14:26:02 projectdiscovery/nuclei-templates

2024-11-17 14:42:23 koodo-reader/koodo-reader