Skip to content

Commit

Permalink
combine next and quarto workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dancingfrog committed Jul 22, 2024
1 parent f4d2550 commit 8cfcf24
Show file tree
Hide file tree
Showing 276 changed files with 2,079 additions and 30,067 deletions.
15 changes: 0 additions & 15 deletions .Rprofile

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Next.js Build

on:
workflow_dispatch:
push:
branches:
- 'dev/**'

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

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

jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
# From https://github.com/r-lib/actions/tree/v2-branch/setup-r
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.1'

- name: Install R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
packages: |
any::renv
# - name: Install R dependencies with renv
# uses: r-lib/actions/setup-renv@v2
# with:
# cache-version: 1

- name: Print GITHUB_TOKEN
run: echo ${{ secrets.GITHUB_TOKEN }}

- name: Print GITHUB_WORKSPACE
run: echo ${GITHUB_WORKSPACE}

# - name: Render and Publish
# uses: quarto-dev/quarto-actions/publish@v2
# with:
# target: gh-pages
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: List outputs after quarto render
# run: |
# ls -l "${GITHUB_WORKSPACE}/_site"

- name: Setup Node.js
uses: ./.github/workflows/node.js

- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next

- name: Build with Next.js
run: npx next build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

- name: List outputs after next build
run: |
ls -l "${GITHUB_WORKSPACE}/out"
92 changes: 92 additions & 0 deletions .github/workflows/next.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Next.js Build & Publish

on:
workflow_dispatch:
push:
branches:
- main

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

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

jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
# From https://github.com/r-lib/actions/tree/v2-branch/setup-r
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.1'

- name: Install R package dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
packages: |
any::renv
# - name: Install R dependencies with renv
# uses: r-lib/actions/setup-renv@v2
# with:
# cache-version: 1

- name: Print GITHUB_TOKEN
run: echo ${{ secrets.GITHUB_TOKEN }}

- name: Print GITHUB_WORKSPACE
run: echo ${GITHUB_WORKSPACE}

# - name: Render and Publish
# uses: quarto-dev/quarto-actions/publish@v2
# with:
# target: gh-pages
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: List outputs after quarto render
# run: |
# ls -l "${GITHUB_WORKSPACE}/_site"

- name: Setup Node.js
uses: ./.github/workflows/node.js

- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next

- name: Build with Next.js
run: npx next build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build

steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

22 changes: 22 additions & 0 deletions .github/workflows/node.js/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: setup-node
description: "Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧"

runs:
using: "composite"
steps:
- name: Setup Node.js ⚙️
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache dependencies ⚡
id: cache_dependencies
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}

- name: Install dependencies 🔧
shell: bash
if: steps.cache_dependencies.outputs.cache-hit != 'true'
run: npm ci
6 changes: 3 additions & 3 deletions .github/workflows/quarto.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Quarto Publish

on:
workflow_dispatch:
push:
branches:
- main
- dev/quarto

name: Quarto Publish
- 'dev/**'

jobs:
build-deploy:
Expand Down
20 changes: 0 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

.DS_Store
.gradle
.idea
.ipynb_checkpoints
/.quarto/
/_site/

bin/
blogdown/
build/
data/
dist/
docs/
log/
man/
node_modules/
R/
.RData
.Rhistory
*.Rproj*
*.bak
*.html
_targets.R
10 changes: 0 additions & 10 deletions Makefile.PL

This file was deleted.

2 changes: 0 additions & 2 deletions Perloku

This file was deleted.

2 changes: 0 additions & 2 deletions R/build.R

This file was deleted.

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "Real~Currents"
---

This site is about signs and symbols in motion; a showcase of
experiments in Information Experience Design (IxD). It’s purpose is to
recognize and explore our need to turn what often appears to be a
tsunami or avalanche of data (waves) into familiar and intuitive
patterns (currents) which have direction, velocity and stability (or
meta-stability).

In terms of information and insight (wisdom):

- Is disruption a consequence or a cause of novel phenomena, or can it
be both?
- Is the inevitable impact of a tsunami to wreak havoc and destruction,
or can it be the first phase of an unfolding wave of chain reactions
which simultaneously transform the previous landscape and give birth
to a new environment?

Our interests lean toward producing and promoting methods for tracing
the potential path (locus) of these phenomena, from where they begin to
where they may lead, with an emphasis on interpretability, reasonability
and usability.
11 changes: 8 additions & 3 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ website:
left:
- href: index.qmd
text: Home
- content/about.qmd
- href: content/about/index.qmd
text: About
- href: content/dev/index.qmd
text: Developer

format:
html:
theme:
- cosmo
- src/styles/custom.scss
css: src/styles/styles.css
- src/custom.scss
css: src/styles.css
toc: true


63 changes: 63 additions & 0 deletions app/content/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from "react";
import fs from "fs";
import matter from "gray-matter";
import Markdown from "markdown-to-jsx";
import { metadata } from "@/app/layout";
import { Post } from "@/types";
import { getPostMetadata } from "@/utils";
import StaticRewriteComponent from "@/components/StaticRewriteComponent";

interface ContentParams {
params: Post;
}

// Return a list of `params` to populate the [slug] dynamic segment
export async function generateStaticParams (): Promise<Post[]> {
// const posts = // await fetch('https://.../posts').then((res) => res.json())
// [
// { slug: "apple_pie" }, // => /content/apple_pie.html
// { slug: "banana_bread" }, // => /content/banana_bread.html
// { slug: "blueberry_scones" }, // => /content/blueberry_scones.html
// { slug: "chocolate_chip_cookies" }, // => /content/chocolate_chip_cookies.html
// { slug: "cinnamon_rolls" }, // => /content/cinnamon_rolls.html
// { slug: "lemon_poppy_seed_muffins" } // => /content/lemon_poppy_seed_muffins.html
// ];

return (
// posts.map((post) => ({
// slug: post.slug,
// }));
getPostMetadata("content/recipes")
);
}

export async function generateMetadata ({ params }: ContentParams) {
const id: string = (!!params?.slug) ? params.slug : '';
return {
title: `${metadata.title} - ${id.replaceAll("_", " ")}`
}
}

function getPostContent (slug: string) {
const file = `./content/recipes/${slug}.md`;
const content = fs.readFileSync(file, "utf8");

const matterResult = matter(content);
return matterResult;
}

// Multiple versions of this page will be statically generated
// using the `params` returned by `generateStaticParams`
export default function ContentPage ({ params }: ContentParams) {
const { slug } = params;
const postMatter = getPostContent(slug);

return (
<main>
<article>
<Markdown>{postMatter.content}</Markdown>
</article>
<StaticRewriteComponent uri={`/content/${slug}.html`} />
</main>
);
}
Loading

0 comments on commit 8cfcf24

Please sign in to comment.