logseq / publish-spa

A github action and CLI to publish logseq graphs as a SPA app
MIT License
244 stars 14 forks source link

GitLab CI example #18

Closed almereyda closed 6 months ago

almereyda commented 11 months ago

What Happened?

logseq-publish had GitLab examples, and now redirects here. Unfortunately no GitLab-related discussion has yet arisen in the issues.

Reproduce the Bug

  1. Check logseq-publish GitLab examples
  2. Find logseq-publish deprecated, linking here
  3. Find no GitLab examples of logseq/publish-spa

Expected Behavior

It could be nice to showcase how to build a LogSeq container in which this CLI runs, and use its image for building LogSeq pages from graphs stored in git repositories on GitLab.

Desktop or Mobile Platform Information

N/A

almereyda commented 11 months ago

I'll likely try this in the next few months.

logseq-cldwalker commented 11 months ago

Hi. I'm happy to take an example link like https://github.com/pengx17/logseq-publish for anyone who wants to work on this. https://github.com/logseq/publish-spa/blob/main/action.yml should be all that's needed to understand replicating this action on another service

logseq-cldwalker commented 6 months ago

There is now https://github.com/L-Trump/logseq-publish-docker for anyone who wants to contribute this documentation

almereyda commented 6 months ago

Thank you for the hint!

This .gitlab-ci.yml manifest works:

image:
  name: ghcr.io/l-trump/logseq-publish-spa:alpine
  entrypoint: ["/bin/sh", "-c"]

stages:
  - deploy

pages:
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

  stage: deploy
  environment: live

  variables:
    THEME: light
    ACCENT_COLOR: blue

  script:
    - mkdir -p public
    - node /opt/logseq-publish-spa/publish_spa.mjs $CI_PROJECT_DIR/public --static-directory /opt/logseq-static --directory $CI_PROJECT_DIR --theme-mode $THEME --accent-color $ACCENT_COLOR

  artifacts:
    paths:
      - public

This assumes pages: public, which is the default and can be omitted.

The top-level stages key could optionally also be omitted, but I like expressiveness.

logseq-cldwalker commented 6 months ago

Nice! I've linked to this example in the readme