-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (94 loc) · 3.26 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (94 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
name: Build and Release
# yamllint disable-line rule:truthy
on:
push:
tags:
- "v*"
# hugo reference: https://gohugo.io/host-and-deploy/host-on-github-pages/
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
env:
# Define tool versions
HUGO_VERSION: 0.164.0
PNPM_VERSION: 11.14
NODE_VERSION: 24.18.0
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0
lfs: false
- name: 📁 Create a local tools directory
run: |
mkdir -p "${HOME}/.local"
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v6
with:
version: ${{ env.PNPM_VERSION }}
- name: 🟩 Install Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "src/themes/**/pnpm-lock.yaml"
- name: 🏗️ Install Hugo
run: |
echo "Installing Hugo ${HUGO_VERSION}..."
HUGO_BASE="https://github.com/gohugoio/hugo/releases"
HUGO_FILE="hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
curl -sfL --output-dir "${{ runner.temp }}" \
-O "${HUGO_BASE}/download/v${HUGO_VERSION}/${HUGO_FILE}"
mkdir "${HOME}/.local/hugo"
tar -C "${HOME}/.local/hugo" \
-xf "${{ runner.temp }}/${HUGO_FILE}"
echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}"
- name: 🔍 Log tool versions
run: |
echo "Logging tool versions..."
command -v hugo &> /dev/null \
&& echo "Hugo: $(hugo version)" \
|| echo "Hugo: not installed"
command -v node &> /dev/null \
&& echo "Node.js: $(node --version)" \
|| echo "Node.js: not installed"
- name: 🎨 Install CSS dependencies and build CSS
working-directory: src/themes/tailbliss
run: |
pnpm install
pnpm run build:css
- name: ♻️ Cache restore
id: cache-restore
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/.cache/hugo
key: hugo-${{ github.run_id }}
restore-keys: hugo-
- name: 📋 Copy built CSS to static directory
working-directory: src
run: cp themes/tailbliss/static/css/main.*.css static/css/
- name: 🚀 Build Hugo (production)
working-directory: src
run: |
echo "Building the project..."
hugo build \
--gc \
--minify \
--cacheDir "${{ runner.temp }}/.cache/hugo"
- name: 💾 Cache save
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/.cache/hugo
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: 📦 Create release archive
run: tar -czf website-${{ github.ref_name }}.tar.gz -C src/public .
- name: 🎉 Create GitHub Release
# yamllint disable-next-line rule:line-length
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
files: website-${{ github.ref_name }}.tar.gz
generate_release_notes: true