Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port website to Franklin.jl #145

Merged
merged 7 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/CleanPreview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# from https://github.com/CliMA/ClimaTimeSteppers.jl
name: Doc Preview Cleanup

on:
pull_request:
types: [closed]

jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [ -d "previews/PR$PRNUM" ]; then
git config user.name "Documenter.jl"
git config user.email "[email protected]"
git rm -rf "previews/PR$PRNUM"
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
env:
PRNUM: ${{ github.event.number }}
14 changes: 14 additions & 0 deletions .github/workflows/Comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PR Comment # Write a comment in the PR with a link to the preview of the given website
on:
pull_request:
types: [opened, reopened]
jobs:
pr_comment:
runs-on: ubuntu-latest
steps:
- name: Create PR comment
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this is a pull request build AND the pull request is NOT made from a fork
uses: thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff
with:
message: 'Once the build has completed, you can preview your PR at this URL: https://fluxml.ai/previews/PR${{ github.event.number }}/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Deploy
on:
push:
branches:
- master
- main
pull_request:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
# NOTE: Python is necessary for the pre-rendering (minification) step
- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.8'
# NOTE: Here you can install dependencies such as matplotlib if you use
# packages such as PyPlot.
# - run: pip install matplotlib
- name: Install Julia
uses: julia-actions/setup-julia@v1
# NOTE
# The steps below ensure that NodeJS and Franklin are loaded then it
# installs highlight.js which is needed for the prerendering step
# (code highlighting + katex prerendering).
# Then the environment is activated and instantiated to install all
# Julia packages which may be required to successfully build your site.
# The last line should be `optimize()` though you may want to give it
# specific arguments, see the documentation or ?optimize in the REPL.
- run: julia -e '
using Pkg; Pkg.add(["NodeJS", "Franklin"]);
using NodeJS; run(`$(npm_cmd()) install highlight.js`);
using Franklin;
Pkg.activate("."); Pkg.instantiate();
optimize()'
- name: Fix URLs for PR preview deployment (pull request previews)
if: github.event_name == 'pull_request'
run: |
echo "PREVIEW_FRANKLIN_WEBSITE_URL=https://fluxml.ai/previews/PR${{ github.event.number }}/" >> $GITHUB_ENV
echo "PREVIEW_FRANKLIN_PREPATH=previews/PR${{ github.event.number }}" >> $GITHUB_ENV
- name: Deploy (preview)
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this build is a PR build and the PR is NOT from a fork
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages # The branch where the PRs previews are stored
folder: __site
token: ${{ secrets.GITHUB_TOKEN }}
target-folder: "previews/PR${{ github.event.number }}" # The website preview is going to be stored in a subfolder
- name: Deploy (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # Replace here the branch where your website is deployed
folder: __site
clean-exclude: |
previews/*
13 changes: 6 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
_site
.sass-cache
.jekyll-metadata
Gemfile.lock

vendor
bin
__site/
.DS_Store
franklin
franklin.pub
node_modules/
Manifest.toml
10 changes: 5 additions & 5 deletions 404.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
layout: page
---

~~~
<style type="text/css" media="screen">
h1 {
padding: 30px 0;
Expand All @@ -13,8 +10,11 @@ layout: page
text-align: center;
}
</style>
~~~

# 404
~~~
<h1>404</h1>
~~~

**Page not found :(**

Expand Down
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

33 changes: 0 additions & 33 deletions Gemfile

This file was deleted.

3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Franklin = "713c75ef-9fc9-4b05-94a9-213340da978e"
NodeJS = "2bd173c7-0d6d-553b-b6af-13a54713934c"
Loading