• This repository has been archived on 14/Apr/2023
  • Stars
    star
    353
  • Rank 120,322 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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/[email protected]
    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.

Kapture.2022-04-14.at.16.57.01.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:

More Repositories

1

logseq-dev-theme

</> Logseq dev theme
CSS
375
star
2

logseq-plugin-tabs

A Logseq plugin which lets you open pages in tabs like working in the browser
TypeScript
299
star
3

logseq-plugin-bullet-threading

Add bullet threading to your active blocks in Logseq.
TypeScript
149
star
4

logseq-plugin-heatmap

Activity heatmap for logseq
TypeScript
145
star
5

logseq-plugin-link-preview

Preview links in logseq
TypeScript
113
star
6

logseq-plugin-todo-master

A simple plugin to render a progress bar to gather the overall progress of the TODO markers based on the rendering position.
TypeScript
110
star
7

logseq-plugin-template-react

Logseq plugin boilerplate for React. Powered by Vite ✨
TypeScript
107
star
8

logseq-laurel-theme

CSS
53
star
9

logseq-plugin-random-tools

TypeScript
24
star
10

pengx17.github.io

我的博客
CSS
21
star
11

knowledge-garden

JavaScript
19
star
12

logseq-plugin-js-playground

TypeScript
16
star
13

logseq-plugin-template-svelte

svelte template for logseq plugins
JavaScript
15
star
14

yjs-textarea-demo

A nearly full featured YJS demo on textarea
TypeScript
10
star
15

vite-plugin-logseq

Vite plugin for developing Logseq Plugins
TypeScript
9
star
16

next-blog-neo

TypeScript
6
star
17

github-board

TypeScript
5
star
18

logseq-query-playground-ui

Clojure
4
star
19

facedetect

A library wrapper for OpenCV. detect faces in (including YUV) images and output a bitmap for the found area.
C++
4
star
20

nextjs-blog

My personal blog
TypeScript
3
star
21

octobase-node

Rust
2
star
22

logseq-query-playfround

Svelte
2
star
23

logseq-plugin-template-vue

logseq, vue, vite
TypeScript
2
star
24

adventofcode2022

Clojure
1
star
25

yjs-playground

Created with StackBlitz ⚡️
TypeScript
1
star
26

idle-game

just for fun
TypeScript
1
star
27

firebase-login

TypeScript
1
star
28

knotes

TypeScript
1
star
29

slides

JavaScript
1
star
30

nc_polymer

Slack like chatroom, built with Polymer
HTML
1
star
31

test-publish-github

1
star
32

next-blog-affine

TypeScript
1
star
33

pengx17

1
star
34

electron-multi-tabs-demo

TypeScript
1
star