Skip to content

Commit

Permalink
Mess with social previews.
Browse files Browse the repository at this point in the history
  • Loading branch information
christhekeele committed Apr 25, 2024
1 parent b88003c commit 59f0385
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 32 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/publish-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ concurrency:
group: publish-site-${{ github.ref }}
cancel-in-progress: true

env:
MIX_ENV: docs
MIX_TARGET: ci

jobs:
build-and-publish:
name: Build and Publish Site
Expand Down Expand Up @@ -40,7 +44,7 @@ jobs:
uses: actions/cache@v4
with:
path: deps
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Install mix dependencies
if: steps.mix-deps-get-cache.outputs.cache-hit != 'true'
Expand All @@ -51,14 +55,14 @@ jobs:
uses: actions/cache@v4
with:
path: _build
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Compile mix dependencies
if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true'
run: mix deps.compile

- name: Build site
run: mix build
run: mix site.build

- name: Upload built static site to Github Pages
uses: actions/upload-pages-artifact@v3
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
MIX_ENV: test
MIX_TARGET: ci

concurrency:
group: test-suite-${{ github.ref }}
Expand Down Expand Up @@ -75,7 +76,7 @@ jobs:
uses: actions/cache@v4
with:
path: deps
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Install mix dependencies
if: steps.mix-deps-get-cache.outputs.cache-hit != 'true'
Expand All @@ -86,7 +87,7 @@ jobs:
uses: actions/cache@v4
with:
path: _build
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Compile mix dependencies
if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true'
Expand All @@ -97,7 +98,7 @@ jobs:
uses: actions/cache@v4
with:
path: priv/plts
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-typecheck
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-typecheck

- name: Setup typechecking
if: steps.mix-typecheck-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
uses: actions/cache@v4
with:
path: deps
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-get-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Install mix dependencies
if: steps.mix-deps-get-cache.outputs.cache-hit != 'true'
Expand All @@ -136,7 +137,7 @@ jobs:
uses: actions/cache@v4
with:
path: _build
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: cache-${{ vars.CACHE_VERSION }}-os-${{ runner.os }}-otp-${{ steps.beam-versions.outputs.otp-version }}-elixir-${{ steps.beam-versions.outputs.elixir-version }}-env-${{ env.MIX_ENV }}-target-${{ env.MIX_TARGET }}-mix-deps-compile-mix-lock-file-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Compile mix dependencies
if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true'
Expand Down
22 changes: 13 additions & 9 deletions livebooks/surreal.livemd
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Surreal Numbers in Elixir

```elixir
System.cmd("mix", ~w[hex.repo add christhekeele https://hex.chriskeele.com])

Mix.install(
[
# {:livebook, "~> 0.0", repo: "chriskeele"},
{:livebook, github: "christhekeele/livebooks", branch: "latest"}
# {:livebook, path: "/Users/keele/Projects/personal/livebooks"}
{:ets, "~> 0.9.0"},
{:eternal, "~> 1.2"},
# {:livebooks, github: "christhekeele/livebooks", branch: "latest"},
{:livebook, "~> 0.0.1-dev", repo: "christhekeele"}
# {:livebooks, path: "/Users/keele/Projects/personal/livebooks"},
],
force: true
)
Expand Down Expand Up @@ -36,12 +40,12 @@ end

## Axioms

- Zero
- One
- Negation
- Addition
- Multiplication
- Division
* Zero
* One
* Negation
* Addition
* Multiplication
* Division

```elixir
zero = {[], []}
Expand Down
96 changes: 81 additions & 15 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ defmodule Livebook.MixProject do

@app :livebook
@name "Chris Keele's Livebooks"
@maintainers ["Chris Keele"]
@licenses ["MIT"]

@homepage_domain "livebooks.chriskeele.com"
@homepage_url "https://#{@homepage_domain}"
@github_url "https://github.com/christhekeele/livebooks"
@github_branch "latest"

@title @name
@blurb "Elixir experiments, guides, and accompanying source code"
@description "#{@blurb} for #{@homepage_url}."
@blurb "#{@blurb}."
@splash_image "#{@homepage_url}/splash.jpg"
@authors ["Chris Keele"]

@extras [
"livebooks/life.livemd": [
Expand All @@ -24,15 +38,6 @@ defmodule Livebook.MixProject do
# Livebooks: ~r/^Livebooks\./
]

@homepage_url "https://livebooks.chriskeele.com"
@github_url "https://github.com/christhekeele/livebooks"
@github_branch "latest"

@description "My livebooks and supporting code for #{@homepage_url}."
@authors ["Chris Keele"]
@maintainers ["Chris Keele"]
@licenses ["MIT"]

@dev_envs [:dev, :test]
@doc_envs [:dev, :docs]

Expand Down Expand Up @@ -79,7 +84,7 @@ defmodule Livebook.MixProject do
]
|> Map.new(&{&1, :test})

doc_tasks = [:build, :docs, :static, :"hex.publish"] |> Map.new(&{&1, :docs})
doc_tasks = [:"site.build", :docs, :static] |> Map.new(&{&1, :docs})

preferred_envs =
%{}
Expand All @@ -103,8 +108,11 @@ defmodule Livebook.MixProject do
# Developer tools
###

# Build tasks
build: ["site.build", "hex.build"],

# Build through ex_doc
build: ["docs"],
"site.build": ["docs", "static"],

# Combination clean utility
clean: [
Expand All @@ -113,9 +121,6 @@ defmodule Livebook.MixProject do
&clean_build_folders/1
],

# Ensure hex.publish also adds static files
docs: ["docs", "static"],

# Installation tasks
install: [
"install.rebar",
Expand Down Expand Up @@ -192,7 +197,7 @@ defmodule Livebook.MixProject do
api_reference: false,
extra_section: "LIVEBOOKS",
logo: "images/logo.png",
# cover: "docs/img/cover.png",
# cover: "images/livebooks.jpg",
extras:
@extras ++
[
Expand Down Expand Up @@ -237,6 +242,67 @@ defmodule Livebook.MixProject do
<meta name="msapplication-TileColor" content="#6932a8">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#6932a8">
<meta name="description" content="#{@title}: #{@blurb}" />
<!-- Facebook Meta Tags -->
<meta
name="og:url"
property="og:url"
content="#{@homepage_url}"
/>
<meta
name="og:type"
property="og:type"
content="website"
/>
<meta
name="og:title"
property="og:title"
content="#{@title}"
/>
<meta
name="og:description"
property="og:description"
content="#{@blurb}"
/>
<meta
name="og:image"
property="og:image"
content="#{@splash_image}"
/>
<!-- Twitter Meta Tags -->
<meta
name="twitter:card"
property="twitter:card"
content="summary_large_image"
/>
<meta
name="twitter:domain"
property="twitter:domain"
content="#{@homepage_domain}"
/>
<meta
name="twitter:url"
property="twitter:url"
content="#{@homepage_url}"
/>
<meta
name="twitter:title"
property="twitter:title"
content="#{@title}"
/>
<meta
name="twitter:description"
property="twitter:description"
content="#{@blurb}"
/>
<meta
name="twitter:image"
property="twitter:image"
content="#{@splash_image}"
/>
"""
end,
before_closing_body_tag: fn _ ->
Expand Down
Binary file added static/splash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 59f0385

Please sign in to comment.