Giter VIP home page Giter VIP logo

logseq-publish's Introduction

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 walk through https://www.youtube.com/watch?v=UYqJcFEYUsY

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]
  - name: add a nojekyll file # to make sure asset paths are correctly identified
    run: touch $GITHUB_WORKSPACE/www/.nojekyll
  - name: Deploy ๐Ÿš€
    uses: JamesIves/[email protected]
    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 or not 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.

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:

logseq-publish's People

Contributors

pengx17 avatar xuanwo avatar unickcheng avatar imyelo avatar logseq-cldwalker avatar ryuheechul avatar strrl avatar tdzienniak avatar emms007 avatar reuixiy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.