mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 17:06:37 -04:00
move to Netlify with native builds (#12)
This commit is contained in:
63
.github/workflows/gh-pages.yml
vendored
63
.github/workflows/gh-pages.yml
vendored
@ -1,63 +0,0 @@
|
||||
name: GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
fetch-depth: 1
|
||||
lfs: false
|
||||
|
||||
# Pull from custom Hugo Extended image with opinionated changes:
|
||||
# https://github.com/jakejarvis/hugo-custom/packages
|
||||
# https://github.com/jakejarvis/hugo-custom/blob/master/Dockerfile
|
||||
# Can't use native `uses: docker://` syntax for GitHub Package Registry...
|
||||
- name: Build Hugo
|
||||
run: |
|
||||
echo ${{ secrets.GITHUB_ACCESS_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
|
||||
docker run -v $GITHUB_WORKSPACE:/src docker.pkg.github.com/jakejarvis/hugo-custom/hugo-custom:latest --gc --cleanDestinationDir --verbose
|
||||
docker logout docker.pkg.github.com
|
||||
|
||||
# Copy built site to a directory where we have permissions, and
|
||||
# add a CNAME file for a custom domain (jarv.is).
|
||||
- name: Prepare for GitHub Pages
|
||||
run: |
|
||||
cp -r $GITHUB_WORKSPACE/public $HOME/gh-pages
|
||||
echo "jarv.is" > $HOME/gh-pages/CNAME
|
||||
|
||||
# Put a bow on top of Hugo's automatic image processing by using
|
||||
# pngquant and jpegoptim to optimize/compress images in posts,
|
||||
# just a little lossily (is that a word?)
|
||||
#
|
||||
# TODO: Find a way to cache the results, this takes about 4 minutes
|
||||
# each build -- not ideal. Maybe use @sindresorhus/imagemin.
|
||||
- name: Optimize processed images
|
||||
run: |
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends jpegoptim pngquant optipng
|
||||
cd $HOME/gh-pages/notes
|
||||
find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --max=80 --strip-all
|
||||
find . -iname "*.png" -print0 | xargs -0 pngquant --quality=50-70 --speed 3 --ext=.png --force
|
||||
find . -iname "*.png" -print0 | xargs -0 optipng -o3 -force -strip all -quiet --
|
||||
# Ignore errors - override pipefail
|
||||
shell: bash {0}
|
||||
|
||||
# Initialize a sub-repository in the new gh-pages directory and
|
||||
# add jakejarvis/jakejarvis.github.io as a remote.
|
||||
# Using native git commands for speed and simplicity, and because
|
||||
# this setup is a weird edge case not worth making an action for.
|
||||
- name: Deploy to jakejarvis.github.io
|
||||
run: |
|
||||
cd $HOME/gh-pages
|
||||
git init
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git remote add origin https://${{ secrets.GITHUB_ACCESS_TOKEN }}@github.com/jakejarvis/jakejarvis.github.io.git
|
||||
git add -A
|
||||
git commit -m "GitHub Pages deploy from $GITHUB_REPOSITORY@$GITHUB_SHA"
|
||||
git push --force origin master
|
@ -1,12 +1,11 @@
|
||||
# 🏡 [jarv.is](https://jarv.is/)
|
||||
|
||||
[](.github/workflows) [](https://github.com/jakejarvis/jarv.is) [](LICENSE.md)
|
||||
[](https://app.netlify.com/sites/jakejarvis/deploys) [](https://github.com/jakejarvis/jarv.is) [](LICENSE.md)
|
||||
|
||||
Personal website of [@jakejarvis](https://github.com/jakejarvis), created and deployed using the following:
|
||||
|
||||
- [Hugo extended](https://github.com/gohugoio/hugo)
|
||||
- [GitHub Pages](https://pages.github.com/)
|
||||
- [GitHub Actions](.github/workflows)
|
||||
- [Netlify](https://www.netlify.com/)
|
||||
- [Commento](https://gitlab.com/commento/commento)
|
||||
|
||||
I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.is/issues/1) as an issue in this repo.
|
||||
|
21
config.toml
21
config.toml
@ -16,6 +16,9 @@ pygmentsCodeFences = true
|
||||
|
||||
enableRobotsTXT = true
|
||||
|
||||
# prefer Netlify's _redirects file, see outputs below
|
||||
disableAliases = true
|
||||
|
||||
[author]
|
||||
name = "Jake Jarvis"
|
||||
email = "jake@jarv.is"
|
||||
@ -32,9 +35,25 @@ enableRobotsTXT = true
|
||||
copyrightFirstYear = "2001"
|
||||
|
||||
[outputs]
|
||||
home = ["HTML", "RSS"]
|
||||
home = ["HTML", "RSS", "REDIRECTS", "HEADERS"]
|
||||
section = ["HTML"]
|
||||
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/netlify"]
|
||||
delimiter = ""
|
||||
|
||||
[outputFormats]
|
||||
[outputFormats.REDIRECTS]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_redirects"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
[outputFormats.HEADERS]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_headers"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
|
||||
[sitemap]
|
||||
filename = "sitemap.xml"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Jake Jarvis – Front-End Web Developer in Boston, MA"
|
||||
date: 2019-10-26 18:04:05-0400
|
||||
date: 2019-11-09 16:26:21-0400
|
||||
description: "Hello! I'm a frontend web developer based in Boston, Massachusetts specializing in modern JavaScript frameworks and progressive web apps."
|
||||
type: home
|
||||
---
|
||||
@ -13,7 +13,7 @@ type: home
|
||||
<p>My recent focus has been on <a href="https://stackoverflow.blog/2018/01/11/brutal-lifecycle-javascript-frameworks/" title=""The Brutal Lifecycle of JavaScript Frameworks" by Ian Allen" id="javascript" target="_blank" rel="noopener noreferrer nofollow">modern JavaScript frameworks</a> like <a href="https://reactjs.org/" title="React Official Website" id="react" target="_blank" rel="noopener noreferrer nofollow">React</a>, <a href="https://angular.io/" title="Angular Official Website" id="angular" target="_blank" rel="noopener noreferrer nofollow">Angular</a>, and <a href="https://vuejs.org/" title="Vue.js Official Website" id="vue" target="_blank" rel="noopener noreferrer nofollow">Vue</a> in front of <a href="https://nodejs.org/en/" title="Node.js Official Website" id="node" target="_blank" rel="noopener noreferrer nofollow">Node</a> and <a href="https://golang.org/" title="Golang Official Website" id="golang" target="_blank" rel="noopener noreferrer nofollow">Go</a> backends...</p>
|
||||
<p>...but I'm fluent in classics like <a href="https://stitcher.io/blog/php-in-2019" title=""PHP in 2019" by Brent Roose" id="php" target="_blank" rel="noopener noreferrer nofollow">PHP</a>, <a href="https://www.ruby-lang.org/en/" title="Ruby Official Website" id="ruby" target="_blank" rel="noopener noreferrer nofollow">Ruby</a>, <a href="https://go.java/index.html" title="Java Official Website" id="java" target="_blank" rel="noopener noreferrer nofollow">Java</a>, <a href="https://isocpp.org/" title="Standard C++ Official Website" id="cpp" target="_blank" rel="noopener noreferrer nofollow">C++</a>, and <a href="https://www.python.org/" title="Python Official Website" id="python" target="_blank" rel="noopener noreferrer nofollow">Python</a> as well.</p>
|
||||
<p>Whenever possible, I also prioritize my experience with <a href="https://bugcrowd.com/jakejarvis" title="Jake Jarvis on Bugcrowd" id="infosec" target="_blank" rel="me noopener noreferrer">information security</a>, <a href="https://martinfowler.com/articles/serverless.html" title=""Serverless Architectures" by Mike Roberts" id="server" target="_blank" rel="noopener noreferrer nofollow">server<span id="serverless">(less)</span> architecture</a>, <a href="https://github.com/kamranahmedse/developer-roadmap/blob/67a72aab113e79c11e292ada394606f079f6a263/images/devops.png" title=""DevOps Roadmap" by Kamran Ahmed" id="devops" target="_blank" rel="noopener noreferrer nofollow">efficient DevOps & CI</a>, and the <a href="https://engineering.fb.com/data-center-engineering/tupperware/" title=""Containerized Deployment at Facebook" by Kenny Yu & Chunqiang Tang" id="containers" target="_blank" rel="noopener noreferrer nofollow">containerization of everything</a>.</p>
|
||||
<p>I fell in love with <a href="/y2k/" title="My Terrible, Horrible, No Good, Very Bad First Website" id="y2k" target="_blank" rel="noopener">frontend web design</a> and <a href="/notes/my-first-code/" title="Jake's Bulletin Board, circa 2003" id="jbb" target="_blank" rel="noopener">backend programming</a> when my only source of income was <a href="/birthday/" title="🎉 Cranky Birthday Boy on VHS Tape 📼" id="birthday" target="_blank" rel="noopener">the Tooth Fairy</a>. <span id="shh">(I've improved a little bit since those projects, I promise...)</span></p>
|
||||
<p>I fell in love with <a href="https://y2k.jarv.is/" title="My Terrible, Horrible, No Good, Very Bad First Website" id="y2k" target="_blank" rel="noopener">frontend web design</a> and <a href="/notes/my-first-code/" title="Jake's Bulletin Board, circa 2003" id="jbb" target="_blank" rel="noopener">backend programming</a> when my only source of income was <a href="/birthday/" title="🎉 Cranky Birthday Boy on VHS Tape 📼" id="birthday" target="_blank" rel="noopener">the Tooth Fairy</a>. <span id="shh">(I've improved a little bit since those projects, I promise...)</span></p>
|
||||
<p>Since then, my side projects
|
||||
<a href="https://tuftsdaily.com/news/2012/04/06/student-designs-iphone-joeytracker-app/" title=""Student designs iPhone JoeyTracker app" on The Tufts Daily" id="news-1" target="_blank" rel="noopener noreferrer nofollow">have</a> <!-- https://archive.fo/LZ3y0 --> <!-- /daily.pdf -->
|
||||
<a href="/leo/" title="Powncer segment on The Lab with Leo Laporte (G4techTV)" id="news-2" target="_blank" rel="noopener">been</a>
|
||||
|
@ -30,8 +30,7 @@
|
||||
# TECHNOLOGY
|
||||
|
||||
Hugo extended
|
||||
GitHub Pages
|
||||
GitHub Actions
|
||||
Netlify
|
||||
Commento
|
||||
|
||||
# VIEW SOURCE
|
||||
|
7
layouts/index.headers
Normal file
7
layouts/index.headers
Normal file
@ -0,0 +1,7 @@
|
||||
# Smart security headers
|
||||
|
||||
/*
|
||||
X-Frame-Options: sameorigin
|
||||
X-XSS-Protection: 1; mode=block
|
||||
Referrer-Policy: no-referrer
|
||||
X-Content-Type-Options: nosniff
|
8
layouts/index.redirects
Normal file
8
layouts/index.redirects
Normal file
@ -0,0 +1,8 @@
|
||||
# Prefer Netlify redirects over Hugo aliases
|
||||
# https://www.netlify.com/docs/redirects/
|
||||
|
||||
{{ range $p := .Site.Pages -}}
|
||||
{{ range .Aliases }}
|
||||
{{- . | printf "%-35s" }} {{ $p.RelPermalink }}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
41
netlify.toml
Normal file
41
netlify.toml
Normal file
@ -0,0 +1,41 @@
|
||||
# netlify.sh downloads my custom Hugo fork and builds the site independently.
|
||||
[build]
|
||||
command = "./scripts/netlify.sh"
|
||||
publish = "public"
|
||||
|
||||
|
||||
# The most important headers and redirects are specified in the _headers and
|
||||
# _redirects files generated by Hugo. These are additional custom redirects.
|
||||
|
||||
# Redirect default Netlify subdomain to primary domain:
|
||||
[[redirects]]
|
||||
from = "https://jakejarvis.netlify.com/*"
|
||||
to = "https://jarv.is/:splat"
|
||||
status = 301
|
||||
force = true
|
||||
|
||||
# Support ancient RSS subscriptions from WordPress era:
|
||||
[[redirects]]
|
||||
from = "/feed"
|
||||
to = "/index.xml"
|
||||
[[redirects]]
|
||||
from = "/rss"
|
||||
to = "/index.xml"
|
||||
|
||||
# Moved Y2K site to its own subdomain:
|
||||
[[redirects]]
|
||||
from = "/y2k/*"
|
||||
to = "https://y2k.jarv.is/:splat"
|
||||
status = 302
|
||||
|
||||
# Redirect iOS tracker files to their repo's GitHub Pages:
|
||||
[[redirects]]
|
||||
from = "/ios-trackers/*"
|
||||
to = "https://jakejarvis.github.io/ios-trackers/:splat"
|
||||
status = 200
|
||||
|
||||
# H A C K E R M A N
|
||||
[[redirects]]
|
||||
from = "/wp-login.php"
|
||||
to = "https://giphy.com/embed/RyXVu4ZW454IM"
|
||||
status = 302
|
6
scripts/docker-build.sh
Executable file
6
scripts/docker-build.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Make sure run from parent directory...
|
||||
|
||||
echo "Building Hugo from Docker image..."
|
||||
docker run -v $(pwd):/src jakejarvis/hugo-custom:latest --gc --cleanDestinationDir --verbose
|
10
scripts/docker-server.sh
Executable file
10
scripts/docker-server.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Make sure run from parent directory...
|
||||
|
||||
echo "Building Docker image..."
|
||||
docker build -t jarv.is:develop -f Dockerfile .
|
||||
|
||||
echo "Starting live Hugo server..."
|
||||
echo "Will go live at: http://localhost:1313"
|
||||
docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop
|
52
scripts/netlify.sh
Executable file
52
scripts/netlify.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# only designed to run on Netlify's build image:
|
||||
# https://github.com/netlify/build-image
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BINDIR=$HOME/jj-bin
|
||||
mkdir -p $BINDIR
|
||||
|
||||
# download forked Hugo extended binary
|
||||
# https://github.com/jakejarvis/hugo-custom/releases
|
||||
echo "Downloading Hugo..."
|
||||
curl -sS -L https://github.com/jakejarvis/hugo-custom/releases/download/v0.53-patch3/hugo-extended -o $BINDIR/hugo-extended
|
||||
chmod +x $BINDIR/hugo-extended
|
||||
|
||||
# download jpegoptim binary
|
||||
echo "Downloading jpegoptim..."
|
||||
curl -sS -L https://github.com/imagemin/jpegoptim-bin/raw/master/vendor/linux/jpegoptim -o $BINDIR/jpegoptim
|
||||
chmod +x $BINDIR/jpegoptim
|
||||
|
||||
# download pngquant binary
|
||||
echo "Downloading pngquant..."
|
||||
curl -sS -L https://github.com/imagemin/pngquant-bin/raw/master/vendor/linux/x64/pngquant -o $BINDIR/pngquant
|
||||
chmod +x $BINDIR/pngquant
|
||||
|
||||
# download optipng binary
|
||||
echo "Downloading optipng..."
|
||||
curl -sS -L https://github.com/imagemin/optipng-bin/raw/master/vendor/linux/x64/optipng -o $BINDIR/optipng
|
||||
chmod +x $BINDIR/optipng
|
||||
|
||||
# make sure everything's OK
|
||||
echo "Is Hugo ready..?"
|
||||
$BINDIR/hugo-extended version
|
||||
|
||||
# build Hugo site
|
||||
echo "Building site..."
|
||||
$BINDIR/hugo-extended --gc --cleanDestinationDir --verbose
|
||||
|
||||
# optimize images in publish directory
|
||||
echo "Optimizing JPEGs..."
|
||||
find ./public -iname "*.jp*" -print0 | xargs -0 $BINDIR/jpegoptim --max=80 --strip-all --quiet
|
||||
echo "Optimizing PNGs..."
|
||||
find ./public -iname "*.png" -print0 | xargs -0 $BINDIR/pngquant --quality=50-70 --speed 3 --ext=.png --force
|
||||
find ./public -iname "*.png" -print0 | xargs -0 $BINDIR/optipng -o3 -force -strip all -quiet --
|
||||
|
||||
# remove binaries (kinda unsafe, but doesn't really matter b/c it's docker)
|
||||
echo "Cleaning up binaries..."
|
||||
rm -rf $BINDIR
|
||||
|
||||
echo "All done!"
|
||||
exit 0
|
Reference in New Issue
Block a user