1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 08:55:32 -04:00

switch CI to use GitHub Package Registry

This commit is contained in:
2019-10-16 00:17:52 -04:00
parent 81e8c37682
commit 4b6bf833a2
3 changed files with 33 additions and 24 deletions

View File

@@ -13,29 +13,35 @@ jobs:
with:
fetch-depth: 1
lfs: false
# pull from custom Hugo Extended image with opinionated changes
# Docker hub: https://hub.docker.com/r/jakejarvis/hugo-custom
# base Dockerfile source: https://go.jarv.is/hugo-dockerfile
# 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
uses: docker://jakejarvis/hugo-custom:latest
with:
args: --gc --cleanDestinationDir
# native git commands for speed and simplicity, and because this
# setup is a weird edge case not worth making an action for.
- name: Push to jakejarvis.github.io
shell: bash
run: |
# copy Hugo output to somewhere we have permissions
echo ${{ secrets.GITHUB_REGISTRY_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
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: |
mkdir gh-pages
cp -r public/* gh-pages
echo "jarv.is" > gh-pages/CNAME
# 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 gh-pages
# CNAME file for GitHub Pages custom domain
echo "jarv.is" > CNAME
# set up git
git init
git config user.name "Jake Jarvis"
git config user.email "jakejarvis@users.noreply.github.com"
# deploy folder to external *.github.io repository
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git remote add target 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"

View File

@@ -1,13 +1,16 @@
# Custom Hugo Extended fork, pre-built on Docker Hub:
# https://hub.docker.com/r/jakejarvis/hugo-custom
# Base Dockerfile source: https://go.jarv.is/hugo-dockerfile
# Custom Hugo Extended fork, pre-built on GitHub Package Registry:
# https://github.com/jakejarvis/hugo-custom/packages
# https://github.com/jakejarvis/hugo-custom/blob/master/Dockerfile
#
# Usage:
# docker build -t jarv.is:develop -f Dockerfile .
# docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop
# docker build -t jarv.is:develop -f Dockerfile .
# docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop
# ...then open http://localhost:1313 for the live-refresh server.
FROM jakejarvis/hugo-custom:latest
FROM docker.pkg.github.com/jakejarvis/hugo-custom/hugo-custom:latest
# verify everything's OK
RUN /usr/bin/hugo version
# add site source as volume
VOLUME /src

View File

@@ -15,7 +15,7 @@ I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.i
## Running a local testing server with Docker
This site runs a [custom version](https://github.com/jakejarvis/hugo-custom) of [Hugo Extended](https://github.com/gohugoio/hugo) with a few (very opinionated) changes. To ensure consistency, the [`Dockerfile`](Dockerfile) in this repository will pull my Hugo [fork](https://github.com/jakejarvis/hugo-custom) (forked from `v0.53-DEV`, [gohugo/hugo@`a28865c`](https://github.com/gohugoio/hugo/tree/a28865cfc3e296cf0ddd0bd6c1368fcdb2154d0f) and pre-built [on Docker Hub](https://hub.docker.com/r/jakejarvis/hugo-custom)) and run a live testing server.
This site runs a [custom version](https://github.com/jakejarvis/hugo-custom) of [Hugo Extended](https://github.com/gohugoio/hugo) with a few (very opinionated) changes. To ensure consistency, the [`Dockerfile`](Dockerfile) in this repository will pull my Hugo [fork](https://github.com/jakejarvis/hugo-custom) (forked from `v0.53-DEV`, [gohugo/hugo@`a28865c`](https://github.com/gohugoio/hugo/tree/a28865cfc3e296cf0ddd0bd6c1368fcdb2154d0f) and pre-built [on GitHub Package Registry](https://github.com/jakejarvis/hugo-custom/packages)) and run a live testing server.
Run these commands on the root of this repository: