Skip to content

Commit

Permalink
added github action for quartz generation
Browse files Browse the repository at this point in the history
  • Loading branch information
carnivuth committed Sep 12, 2024
1 parent a203db4 commit 768a06c
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Deploy Quartz site to GitHub Pages

on:
push:
branches:
- main
paths-ignore:
- ".gitignore"
- "readme.md"


permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info

- name: Clone quartz
uses: GuillaumeFalourd/clone-github-repo-action@v2.3
with:
branch: 'v4'
owner: 'jackyzha0'
repository: 'quartz'

- name: build
run: >
cd $HOME
&& git clone https://github.com/jackyzha0/quartz
&& cp $GITHUB_WORKSPACE/quartz.config.ts quartz
&& cp $GITHUB_WORKSPACE/quartz.layout.ts quartz
&& cd quartz
&& npm install
&& npx quartz create -s $GITHUB_WORKSPACE -X copy -l shortest
&& rm -rf content/quartz
&& npx quartz build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: /home/runner/quartz/public

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
93 changes: 93 additions & 0 deletions quartz.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { QuartzConfig } from "./quartz/cfg"
import * as Plugin from "./quartz/plugins"

/**
* Quartz 4.0 Configuration
*
* See https://quartz.jzhao.xyz/configuration for more information.
*/
const config: QuartzConfig = {
configuration: {
pageTitle: "Datamining",
enableSPA: true,
enablePopovers: true,
analytics: {
provider: "plausible",
},
locale: "en-US",
baseUrl: "carnivuth.github.io/datamining",
ignorePatterns: ["private", "templates", ".obsidian"],
defaultDateType: "created",
theme: {
fontOrigin: "googleFonts",
cdnCaching: true,
typography: {
header: "Schibsted Grotesk",
body: "Source Sans Pro",
code: "IBM Plex Mono",
},
colors: {
lightMode: {
light: "#faf8f8",
lightgray: "#e5e5e5",
gray: "#b8b8b8",
darkgray: "#4e4e4e",
dark: "#2b2b2b",
secondary: "#284b63",
tertiary: "#84a59d",
highlight: "rgba(143, 159, 169, 0.15)",
textHighlight: "#fff23688",
},
darkMode: {
light: "#161618",
lightgray: "#393639",
gray: "#646464",
darkgray: "#d4d4d4",
dark: "#ebebec",
secondary: "#7b97aa",
tertiary: "#84a59d",
highlight: "rgba(143, 159, 169, 0.15)",
textHighlight: "#b3aa0288",
},
},
},
},
plugins: {
transformers: [
Plugin.FrontMatter(),
Plugin.CreatedModifiedDate({
priority: ["frontmatter", "filesystem"],
}),
Plugin.SyntaxHighlighting({
theme: {
light: "github-light",
dark: "github-dark",
},
keepBackground: false,
}),
Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }),
Plugin.GitHubFlavoredMarkdown(),
Plugin.TableOfContents(),
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
Plugin.Description(),
Plugin.Latex({ renderEngine: "katex" }),
],
filters: [Plugin.RemoveDrafts()],
emitters: [
Plugin.AliasRedirects(),
Plugin.ComponentResources(),
Plugin.ContentPage(),
Plugin.FolderPage(),
Plugin.TagPage(),
Plugin.ContentIndex({
enableSiteMap: true,
enableRSS: true,
}),
Plugin.Assets(),
Plugin.Static(),
Plugin.NotFoundPage(),
],
},
}

export default config
47 changes: 47 additions & 0 deletions quartz.layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { PageLayout, SharedLayout } from "./quartz/cfg"
import * as Component from "./quartz/components"

// components shared across all pages
export const sharedPageComponents: SharedLayout = {
head: Component.Head(),
header: [],
afterBody: [],
footer: Component.Footer({
links: {
GitHub: "https://github.com/carnivuth/datamining",
},
}),
}

// components for pages that display a single page (e.g. a single note)
export const defaultContentPageLayout: PageLayout = {
beforeBody: [
Component.Breadcrumbs(),
//Component.ArticleTitle(),
Component.ContentMeta(),
Component.TagList(),
],
left: [
Component.MobileOnly(Component.Spacer()),
Component.Search(),
Component.Darkmode(),
Component.DesktopOnly(Component.Explorer()),
],
right: [
Component.Graph(),
Component.DesktopOnly(Component.TableOfContents()),
Component.Backlinks(),
],
}

// components for pages that display lists of pages (e.g. tags or folders)
export const defaultListPageLayout: PageLayout = {
beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()],
left: [
Component.MobileOnly(Component.Spacer()),
Component.Search(),
Component.Darkmode(),
Component.DesktopOnly(Component.Explorer()),
],
right: [],
}

0 comments on commit 768a06c

Please sign in to comment.