mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-10 02:26:08 +01:00
Simplify the deploy scripts
I'll be moving to deployment from my homelab soon (I hope), so this should simplify things.
This commit is contained in:
parent
afbbff095c
commit
4b59699934
5 changed files with 53 additions and 25 deletions
3
.env
3
.env
|
@ -1,3 +0,0 @@
|
|||
HUGO_LAST_UPDATE_TIME=$(git log -1 --format=%cI)
|
||||
HUGO_LAST_UPDATE_HASH=$(git log -1 --format=%h)
|
||||
HUGO_INDIEKIT_URL=https://indiekit.byjp.me${DOMAIN_SUFFIX}
|
33
.github/workflows/publish.yml
vendored
33
.github/workflows/publish.yml
vendored
|
@ -26,12 +26,24 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HUGO_VERSION: 0.123.8
|
||||
HUGO_VERSION: 0.124.1
|
||||
PAGEFIND_VERSION: 1.1.0
|
||||
TASK_VERSION: 3.36.0
|
||||
steps:
|
||||
- name: Install Hugo CLI
|
||||
run: |
|
||||
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
||||
wget -q -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
||||
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
||||
- name: Install Pagefind CLI
|
||||
run: |
|
||||
wget -q -O ${{ runner.temp }}/pagefind.tar.gz https://github.com/CloudCannon/pagefind/releases/download/v${PAGEFIND_VERSION}/pagefind-v${PAGEFIND_VERSION}-x86_64-unknown-linux-musl.tar.gz \
|
||||
&& tar -xpf ${{ runner.temp }}/pagefind.tar.gz pagefind \
|
||||
&& mv pagefind /usr/local/bin/pagefind
|
||||
- name: Install Task CLI
|
||||
run: |
|
||||
wget -q -O ${{ runner.temp }}/task.tar.gz https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_linux_amd64.tar.gz \
|
||||
&& tar -xpf ${{ runner.temp }}/task.tar.gz task \
|
||||
&& mv task /usr/local/bin/task
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -46,21 +58,8 @@ jobs:
|
|||
with:
|
||||
path: /tmp/hugo
|
||||
key: ${{ env.cache-name }}
|
||||
- name: Build with Hugo
|
||||
env:
|
||||
# For maximum backward compatibility with Hugo modules
|
||||
HUGO_ENVIRONMENT: production
|
||||
HUGO_ENV: production
|
||||
run: |
|
||||
set -o allexport; source .env; set +o allexport
|
||||
hugo \
|
||||
--cacheDir /tmp/hugo/cache \
|
||||
--minify \
|
||||
--baseURL "https://www.byjp.me"
|
||||
- name: Build search index
|
||||
run: |
|
||||
# Build the search index
|
||||
npm_config_yes=true npx pagefind@latest
|
||||
- name: Build site
|
||||
run: task build
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
with:
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
/resources/_gen/
|
||||
/.hugo_build.lock
|
||||
/.lycheecache
|
||||
.env
|
||||
|
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
|||
FROM golang:1.22-alpine
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ENV PAGEFIND_VERSION=1.1.0
|
||||
ENV TASK_VERSION=3.36.0
|
||||
|
||||
RUN apk update && \
|
||||
apk add ca-certificates wget git hugo && \
|
||||
update-ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN wget -q -O pagefind.tar.gz "https://github.com/CloudCannon/pagefind/releases/download/v${PAGEFIND_VERSION}/pagefind-v${PAGEFIND_VERSION}-$(if [ "$TARGETPLATFORM" = "linux/arm64" ]; then echo "aarch64"; else echo "x86_64"; fi)-unknown-linux-musl.tar.gz" \
|
||||
&& tar -xpf pagefind.tar.gz pagefind \
|
||||
&& mv pagefind /usr/local/bin/pagefind \
|
||||
&& rm pagefind.tar.gz
|
||||
|
||||
RUN wget -q -O task.tar.gz "https://github.com/go-task/task/releases/download/v${TASK_VERSION}/task_${TARGETPLATFORM//\//_}.tar.gz" \
|
||||
&& tar -xpf task.tar.gz task \
|
||||
&& mv task /usr/local/bin/task \
|
||||
&& rm task.tar.gz
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
CMD ["task", "build"]
|
16
Taskfile.yml
16
Taskfile.yml
|
@ -7,22 +7,28 @@ version: '3'
|
|||
|
||||
env:
|
||||
DOMAIN: https://www.byjp.me
|
||||
HUGO_INDIEKIT_URL: https://indiekit.byjp.me{{.DOMAIN_SUFFIX}}
|
||||
HUGO_LAST_UPDATE_TIME:
|
||||
sh: git log -1 --format=%cI
|
||||
HUGO_LAST_UPDATE_HASH:
|
||||
sh: git log -1 --format=%h
|
||||
|
||||
tasks:
|
||||
check-links:
|
||||
cmds:
|
||||
- lychee --cache --require-https --config lychee.toml .
|
||||
|
||||
dev:
|
||||
env:
|
||||
DOMAIN_SUFFIX: .test
|
||||
cmds:
|
||||
- |
|
||||
set -o allexport; source .env; set +o allexport
|
||||
hugo server --minify --printUnusedTemplates -D --baseURL "${DOMAIN}${DOMAIN_SUFFIX}" --appendPort=false
|
||||
- hugo server --minify --printUnusedTemplates -D --baseURL "${DOMAIN}${DOMAIN_SUFFIX}" --appendPort=false
|
||||
|
||||
build:
|
||||
cmds:
|
||||
cmds:
|
||||
- hugo --cacheDir /tmp/hugo/cache --gc --minify --baseURL "${DOMAIN}"
|
||||
- npm_config_yes=true npx pagefind@latest
|
||||
- pagefind
|
||||
|
||||
import:
|
||||
dir: tools/
|
||||
cmds:
|
||||
|
|
Loading…
Reference in a new issue