Skip to content

Commit 4f84fb8

Browse files
committed
chore: add GitHub CI
1 parent 5565e93 commit 4f84fb8

2 files changed

Lines changed: 85 additions & 1 deletion

File tree

.github/workflows/build.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build and deploy
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
concurrency:
10+
group: pages
11+
cancel-in-progress: false
12+
defaults:
13+
run:
14+
shell: bash
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
env:
19+
DART_SASS_VERSION: 1.93.2
20+
GO_VERSION: 1.25.3
21+
HUGO_VERSION: 0.152.2
22+
NODE_VERSION: 22.20.0
23+
TZ: Europe/Oslo
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
with:
28+
submodules: recursive
29+
fetch-depth: 0
30+
- name: Setup Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: ${{ env.GO_VERSION }}
34+
cache: false
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ env.NODE_VERSION }}
39+
- name: Create directory for user-specific executable files
40+
run: |
41+
mkdir -p "${HOME}/.local"
42+
- name: Install Dart Sass
43+
run: |
44+
curl -sLJO "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
45+
tar -C "${HOME}/.local" -xf "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
46+
rm "dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz"
47+
echo "${HOME}/.local/dart-sass" >> "${GITHUB_PATH}"
48+
- name: Install Hugo
49+
run: |
50+
curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
51+
mkdir "${HOME}/.local/hugo"
52+
tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
53+
rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
54+
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
55+
- name: Verify installations
56+
run: |
57+
echo "Dart Sass: $(sass --version)"
58+
echo "Go: $(go version)"
59+
echo "Hugo: $(hugo version)"
60+
echo "Node.js: $(node --version)"
61+
- name: Install Node.js dependencies
62+
run: |
63+
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
64+
- name: Configure Git
65+
run: |
66+
git config core.quotepath false
67+
- name: Cache restore
68+
id: cache-restore
69+
uses: actions/cache/restore@v4
70+
with:
71+
path: ${{ runner.temp }}/hugo_cache
72+
key: hugo-${{ github.run_id }}
73+
restore-keys:
74+
hugo-
75+
- name: Build the site
76+
run: |
77+
chmod +x build.sh && ./build.sh
78+
- name: Install SSH key
79+
uses: shimataro/ssh-key-action@v2
80+
with:
81+
key: ${{ secrets.SSH_PRIVATE_KEY }}
82+
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
83+
- name: rsync over SSH
84+
run: rsync -e 'ssh -p 20200' -r ./public/ rsync@asie.pl:/

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ if [ ! -d themes/hugo-geekdoc ]; then
99
tar xzvfC _deps/hugo-geekdoc.tar.gz themes/hugo-geekdoc
1010
fi
1111

12-
hugo --cleanDestinationDir
12+
hugo --cleanDestinationDir --gc --minify

0 commit comments

Comments
 (0)