Skip to content

Commit 015e516

Browse files
committed
refactor
1 parent 561ebb4 commit 015e516

File tree

39 files changed

+751
-438
lines changed

39 files changed

+751
-438
lines changed

.devcontainer/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Update the NODE_VERSION arg in docker-compose.yml to pick a Node version: 18, 16, 14
2+
ARG NODE_VERSION=16
3+
FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION}
4+
5+
# VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
6+
ARG VARIANT=hugo
7+
# VERSION can be either 'latest' or a specific version number
8+
ARG VERSION=latest
9+
10+
# Download Hugo
11+
RUN apt-get update && apt-get install -y ca-certificates openssl git curl && \
12+
rm -rf /var/lib/apt/lists/* && \
13+
case ${VERSION} in \
14+
latest) \
15+
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
16+
esac && \
17+
echo ${VERSION} && \
18+
case $(uname -m) in \
19+
aarch64) \
20+
export ARCH=ARM64 ;; \
21+
*) \
22+
export ARCH=64bit ;; \
23+
esac && \
24+
echo ${ARCH} && \
25+
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
26+
tar xf ${VERSION}.tar.gz && \
27+
mv hugo /usr/bin/hugo
28+
29+
# Hugo dev server port
30+
EXPOSE 1313
31+
32+
# [Optional] Uncomment this section to install additional OS packages you may want.
33+
#
34+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
35+
# && apt-get -y install --no-install-recommends <your-package-list-here>
36+
37+
# [Optional] Uncomment if you want to install more global node packages
38+
# RUN sudo -u node npm install -g <your-package-list-here>

.devcontainer/devcontainer.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "Hugo (Community)",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
// Update VARIANT to pick hugo variant.
7+
// Example variants: hugo, hugo_extended
8+
// Rebuild the container if it already exists to update.
9+
"VARIANT": "hugo_extended",
10+
// Update VERSION to pick a specific hugo version.
11+
// Example versions: latest, 0.73.0, 0,71.1
12+
// Rebuild the container if it already exists to update.
13+
"VERSION": "latest",
14+
// Update NODE_VERSION to pick the Node.js version: 12, 14
15+
"NODE_VERSION": "14"
16+
}
17+
},
18+
19+
// Configure tool-specific properties.
20+
"customizations": {
21+
// Configure properties specific to VS Code.
22+
"vscode": {
23+
// Set *default* container specific settings.json values on container create.
24+
"settings": {
25+
"html.format.templating": true
26+
},
27+
28+
// Add the IDs of extensions you want installed when the container is created.
29+
"extensions": [
30+
"tamasfe.even-better-toml",
31+
"davidanson.vscode-markdownlint"
32+
]
33+
}
34+
},
35+
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
"forwardPorts": [
38+
1313
39+
],
40+
41+
// Use 'postCreateCommand' to run commands after the container is created.
42+
// "postCreateCommand": "uname -a",
43+
44+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
45+
"remoteUser": "node",
46+
"features": {
47+
"ghcr.io/devcontainers/features/go:1": {
48+
"version": "latest"
49+
}
50+
}
51+
}

.editorconfig

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy to Github Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
# Give the default GITHUB_TOKEN write permission to commit and push the
15+
# added or changed files to the repository.
16+
contents: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Cache Hugo resources
24+
uses: actions/cache@v4
25+
env:
26+
cache-name: cache-hugo-resources
27+
with:
28+
path: resources
29+
key: ${{ env.cache-name }}
30+
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version: "^1.17.0"
34+
- run: go version
35+
36+
- name: Setup Hugo
37+
uses: peaceiris/actions-hugo@v2
38+
with:
39+
hugo-version: "latest"
40+
extended: true
41+
42+
- name: Build
43+
run: hugo --minify --gc
44+
45+
- name: Deploy 🚀
46+
uses: JamesIves/github-pages-deploy-action@v4
47+
with:
48+
branch: gh-pages
49+
folder: public
50+
clean: true
51+
single-commit: true

.github/workflows/update-theme.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update theme
2+
3+
# Controls when the workflow will run
4+
on:
5+
schedule:
6+
# Update theme automatically everyday at 00:00 UTC
7+
- cron: "0 0 * * *"
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
update-theme:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
# Give the default GITHUB_TOKEN write permission to commit and push the
17+
# added or changed files to the repository.
18+
contents: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup Hugo
24+
uses: peaceiris/actions-hugo@v2
25+
with:
26+
hugo-version: 0.123.8
27+
extended: true
28+
29+
- name: Update theme
30+
run: hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v3
31+
32+
- name: Tidy go.mod, go.sum
33+
run: hugo mod tidy
34+
35+
- name: Commit changes
36+
uses: stefanzweifel/git-auto-commit-action@v5
37+
with:
38+
commit_message: "CI: Update theme"

.gitignore

Lines changed: 3 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,4 @@
1-
.vscode/*
2-
!.vscode/settings.json
3-
!.vscode/tasks.json
4-
!.vscode/launch.json
5-
!.vscode/extensions.json
6-
!.vscode/*.code-snippets
7-
8-
# Local History for Visual Studio Code
9-
.history/
10-
11-
# Built Visual Studio Code Extensions
12-
*.vsix
13-
14-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
15-
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
16-
17-
# User-specific stuff
18-
.idea/**/workspace.xml
19-
.idea/**/tasks.xml
20-
.idea/**/usage.statistics.xml
21-
.idea/**/dictionaries
22-
.idea/**/shelf
23-
24-
# AWS User-specific
25-
.idea/**/aws.xml
26-
27-
# Generated files
28-
.idea/**/contentModel.xml
29-
30-
# Sensitive or high-churn files
31-
.idea/**/dataSources/
32-
.idea/**/dataSources.ids
33-
.idea/**/dataSources.local.xml
34-
.idea/**/sqlDataSources.xml
35-
.idea/**/dynamic.xml
36-
.idea/**/uiDesigner.xml
37-
.idea/**/dbnavigator.xml
38-
39-
# Gradle
40-
.idea/**/gradle.xml
41-
.idea/**/libraries
42-
43-
# Gradle and Maven with auto-import
44-
# When using Gradle or Maven with auto-import, you should exclude module files,
45-
# since they will be recreated, and may cause churn. Uncomment if using
46-
# auto-import.
47-
.idea/artifacts
48-
.idea/compiler.xml
49-
.idea/jarRepositories.xml
50-
.idea/modules.xml
51-
.idea/*.iml
52-
.idea/modules
53-
*.iml
54-
*.ipr
55-
56-
# CMake
57-
cmake-build-*/
58-
59-
# Mongo Explorer plugin
60-
.idea/**/mongoSettings.xml
61-
62-
# File-based project format
63-
*.iws
64-
65-
# IntelliJ
66-
out/
67-
68-
# mpeltonen/sbt-idea plugin
69-
.idea_modules/
70-
71-
# JIRA plugin
72-
atlassian-ide-plugin.xml
73-
74-
# Cursive Clojure plugin
75-
.idea/replstate.xml
76-
77-
# SonarLint plugin
78-
.idea/sonarlint/
79-
80-
# Crashlytics plugin (for Android Studio and IntelliJ)
81-
com_crashlytics_export_strings.xml
82-
crashlytics.properties
83-
crashlytics-build.properties
84-
fabric.properties
85-
86-
# Editor-based Rest Client
87-
.idea/httpRequests
88-
89-
# Android studio 3.1+ serialized cache file
90-
.idea/caches/build_file_checksums.ser
91-
92-
# Just ignore everything for the website.
1+
public
2+
resources
3+
.hugo_build.lock
934
.idea/

.vscode/tasks.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Serve Drafts",
8+
"type": "shell",
9+
"command": "hugo server -D",
10+
"group": {
11+
"kind": "test",
12+
"isDefault": true
13+
},
14+
"isBackground": true,
15+
"problemMatcher": []
16+
},
17+
{
18+
"label": "Build",
19+
"type": "shell",
20+
"command": "hugo",
21+
"group": {
22+
"kind": "build",
23+
"isDefault": true
24+
},
25+
"problemMatcher": []
26+
}
27+
]
28+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Jimmy Cai
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)