/obsidian-publish-action

Obsidian publish github action

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Obsidian Publish Github Action

GitHub Action that publishes Obsidian vault in MkDocs format, when pushed to the GitHub repository to Netlify.

  • This action parses the the Obsidian vault markdown (.md file) to the markdown format supported by MkDocs, compresses all the images and publishes the website to Netlify.
  • This action is triggered by a push to the publish branch.

Usage

name: Publish Vault
on: [push]
jobs:
  Publish-Obsidian-Vault:
    runs-on: ubuntu-latest
    steps:
      - name: Publish Vault
        uses: project-cool/obsidian-publish-action@main
        with:
          websiteId: "<your-netlify-website-id>" # required
          log_level: "info"                      
          token: ${{ secrets.NETLIFY_TOKEN }}    # required
          branch: "publish"  
          image_resolution: 1920
          compression_factor: 20
          suppress_mkdocs_logs: true   

The unrequired fields have the default values written above.

Instructions

  1. Create a new repository to which the Obsidian vault will be pushed.
  2. The root folder should contain .github/workflows/publish-obsidian-vault.yml and mkdocs.yml
  3. Create a github secret which will store your Netlify access token.
  4. You can have the following directory structure
obsidian-vault
└─── .github
│   └─── workflows
│       │   publish-obsidian-vault.yml
│
└─── mkdocs.yml
│
│─── .git
│
│─── notes
│   │   blog.md
│   └─── engineering
│       │   scientist.md
│       │   ceo.md
│       │   mba.md
  1. Supported frontmatter format
---
updated: 2022-06-03
hidden: true
---
  • If hidden is not mentioned, it is considered as false (by default, all the MD pages will be published online). If hidden: true, the corresponding MD file will be ignored.
  • updated is accepted as either 2022-06-03 or 2022-06-03T20:00:48+05:30. This can by generated automatically for all the pages in Obsidian by using Update time on edit plugin.
Sample mkdocs.yml

site_name: Your Notes
theme:
  name: material

  features:
    - navigation.tabs
    - navigation.top
  palette:
    - media: "(prefers-color-scheme: light)"
      scheme: default
      primary: indigo
      accent: indigo
      toggle:
        icon: material/lightbulb
        name: Switch to dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      primary: teal
      accent: teal
      toggle:
        icon: material/lightbulb-outline
        name: Switch to light mode

markdown_extensions:
  - meta
  - toc:
      permalink: true
  - pymdownx.highlight:
      anchor_linenums: true
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences
  - admonition
  - pymdownx.details
  - pymdownx.superfences

extra:
  homepage: https://your-website.org

  social:
    - icon: fontawesome/brands/linkedin
      link: https://www.twitter.com
    - icon: fontawesome/brands/youtube
      link: https://www.twitter.com
    - icon: fontawesome/brands/instagram
      link: https://www.twitter.com

copyright: Copyright &copy; 2022 Your name

References

GitHub Actions

MkDocs