OSDN Git Service

[add] : Added blog
authorhayao <hayao@fascode.net>
Sat, 9 Oct 2021 12:38:49 +0000 (21:38 +0900)
committerhayao <hayao@fascode.net>
Sat, 9 Oct 2021 12:38:49 +0000 (21:38 +0900)
.github/workflows/hugo.yaml [new file with mode: 0644]
.gitmodules [new file with mode: 0644]
blog/.gitignore [new file with mode: 0644]
blog/archetypes/default.md [new file with mode: 0644]
blog/config.toml [new file with mode: 0644]
blog/content/posts/20211009/index.md [new file with mode: 0644]
blog/themes/smigle [new submodule]
blog/update-theme.sh [new file with mode: 0755]

diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml
new file mode 100644 (file)
index 0000000..8c4102f
--- /dev/null
@@ -0,0 +1,30 @@
+name: Hugo
+
+on: push
+
+jobs:
+  gh-pages:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+        with:
+          submodules: true
+          fetch-depth: 0 
+
+      # https://github.com/marketplace/actions/github-pages-action
+      - name: Setup
+        uses: peaceiris/actions-hugo@v2
+        with:
+          hugo-version: '0.88.1'
+          extended: true
+
+      - name: Build
+        run: hugo --minify
+
+      - name: Deploy
+        uses: peaceiris/actions-gh-pages@v3
+        with:
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+          publish_branch: gh-pages
+          publish_dir: ./public
diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..1974fa1
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "blog/themes/smigle"]
+       path = blog/themes/smigle
+       url = https://gitlab.com/ian-s-mcb/smigle-hugo-theme.git
diff --git a/blog/.gitignore b/blog/.gitignore
new file mode 100644 (file)
index 0000000..364fdec
--- /dev/null
@@ -0,0 +1 @@
+public/
diff --git a/blog/archetypes/default.md b/blog/archetypes/default.md
new file mode 100644 (file)
index 0000000..00e77bd
--- /dev/null
@@ -0,0 +1,6 @@
+---
+title: "{{ replace .Name "-" " " | title }}"
+date: {{ .Date }}
+draft: true
+---
+
diff --git a/blog/config.toml b/blog/config.toml
new file mode 100644 (file)
index 0000000..c9e90f1
--- /dev/null
@@ -0,0 +1,4 @@
+baseURL = 'http://example.org/'
+languageCode = 'ja-JP'
+title = 'ハヤオのブログ'
+theme = "smigle"
diff --git a/blog/content/posts/20211009/index.md b/blog/content/posts/20211009/index.md
new file mode 100644 (file)
index 0000000..55b2c9d
--- /dev/null
@@ -0,0 +1,11 @@
+---
+title: "最初の投稿"
+date: 2021-10-09T21:10:53+09:00
+draft: true
+---
+
+ハヤオのブログをHugoを使って作ってみた。
+
+マークダウンだけでこうやってかけるのシンプルでいいですね。
+
+Fascodeのブログに載せられないものでもこれからちょこちょこ書いていこうかしら()
diff --git a/blog/themes/smigle b/blog/themes/smigle
new file mode 160000 (submodule)
index 0000000..13c241e
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 13c241e8ab83a0162d7c3e3eaefaadb0843bf38d
diff --git a/blog/update-theme.sh b/blog/update-theme.sh
new file mode 100755 (executable)
index 0000000..69f464f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -eu
+
+script_path="$( cd -P "$( dirname "$(readlink -f "${0}")" )" && pwd )"
+theme_dir="${script_path}/themes/"
+
+cd "${theme_dir}"
+for _theme in "${theme_dir}/"*; do
+    cd "${_theme}"
+    current_commit_id="$(git rev-parse --short HEAD)"
+    default_branch="$(git remote show origin | grep 'HEAD branch' | awk '{print $NF}')"
+    git checkout "${default_branch}"
+    git pull
+    new_commit_id="$(git rev-parse --short HEAD)"
+    cd "${script_path}"
+
+
+    if [[ ! "${current_commit_id}" = "${new_commit_id}" ]]; then
+        git add "${_theme}"
+        git commit -S -m "Updated hugo theme (${new_commit_id})"
+    fi
+
+    git push
+done