From 02788d2fe5ed9be1644b5f84d81d6bfdfc9922b3 Mon Sep 17 00:00:00 2001
From: loikein <wanleiqiong@gmail.com>
Date: Mon, 1 May 2023 16:49:52 +0000
Subject: [PATCH] Publish example site (via Netlify) (#11)

* modify test CI
* add test ci badge back
* use newest hugo version for test ci
* add netlify.toml
* add netlify badge
---
 .github/workflows/build-site-ghpages.yml | 33 ------------------------
 .github/workflows/test-build.yml         |  6 ++---
 README.md                                |  2 +-
 config.toml                              |  2 +-
 exampleSite/config.yaml                  |  7 +++--
 go.mod                                   |  2 +-
 netlify.toml                             |  6 +++++
 theme.toml                               |  4 +--
 8 files changed, 17 insertions(+), 45 deletions(-)
 delete mode 100644 .github/workflows/build-site-ghpages.yml
 create mode 100644 netlify.toml

diff --git a/.github/workflows/build-site-ghpages.yml b/.github/workflows/build-site-ghpages.yml
deleted file mode 100644
index 75a4543..0000000
--- a/.github/workflows/build-site-ghpages.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-name: Build for Github Pages
-
-on:
-  push:
-    branches:
-      - master  # Set a branch to deploy
-
-jobs:
-  deploy:
-    runs-on: ubuntu-latest
-    defaults:
-      run:
-        working-directory: ./exampleSite
-    steps:
-      - uses: actions/checkout@v2
-        with:
-          submodules: true  # Fetch Hugo themes (true OR recursive)
-          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod
-
-      - name: Setup Hugo
-        uses: peaceiris/actions-hugo@v2
-        with:
-          hugo-version: '0.83.1'
-          extended: true
-
-      - name: Build
-        run: hugo --minify
-
-      - name: Deploy
-        uses: peaceiris/actions-gh-pages@v3
-        with:
-          github_token: ${{ secrets.GH_TOKEN }}
-          publish_dir: ./exampleSite/public
\ No newline at end of file
diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml
index bd75dd8..0d358dd 100644
--- a/.github/workflows/test-build.yml
+++ b/.github/workflows/test-build.yml
@@ -1,6 +1,6 @@
 name: Test Build 
 
-on: [pull_request]
+on: push
 
 jobs:
   deploy:
@@ -17,8 +17,8 @@ jobs:
       - name: Setup Hugo
         uses: peaceiris/actions-hugo@v2
         with:
-          hugo-version: '0.83.1'
+          hugo-version: 'latest'
           extended: true
 
       - name: Build
-        run: hugo --minify
+        run: hugo --gc --minify
diff --git a/README.md b/README.md
index 1740030..f7c6417 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Tufte Hugo Theme
 
-[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md)
+[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md) [![Test Build](https://github.com/loikein/hugo-tufte/actions/workflows/test-build.yml/badge.svg)](https://github.com/loikein/hugo-tufte/actions/workflows/test-build.yml) [![Netlify Status](https://api.netlify.com/api/v1/badges/0a3e11e2-0209-40bb-8570-c3eb9b8471dc/deploy-status)](https://app.netlify.com/sites/huto-tufte/deploys)
 
 ## History of this project
 
diff --git a/config.toml b/config.toml
index fbb88d9..9eee913 100644
--- a/config.toml
+++ b/config.toml
@@ -1,4 +1,4 @@
 [module]
     [module.hugoVersion]
     extended = true
-    min = "0.83.0"
\ No newline at end of file
+    min = "0.83.0"
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index c6f1ee5..888b047 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -1,14 +1,13 @@
-# Remove this if your site folder is not inside the theme folder
-themesDir: "../../"
-
 # Set your theme here
 theme: hugo-tufte
+# Remove this if your site folder is not inside the theme folder
+themesDir: "../.."
 # The language of your website (see https://www.andiamo.co.uk/resources/iso-language-codes/ for reference)
 languageCode: en-US
 # If you write Chinese, Japanese or Korean, this helps with word counting
 hasCJKLanguage: true
 # The url of your website
-baseurl: "https://example.com/"
+baseurl: "https://huto-tufte.netlify.app/"
 # The title of your website (shown on all the pages)
 title: "Hugo-Tufte Theme Example Site"
 canonifyurls: true
diff --git a/go.mod b/go.mod
index b80effd..b35398f 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
-module github.com/slashformotion/hugo-tufte
+module github.com/loikein/hugo-tufte
 
 go 1.17
diff --git a/netlify.toml b/netlify.toml
new file mode 100644
index 0000000..ccf8a0e
--- /dev/null
+++ b/netlify.toml
@@ -0,0 +1,6 @@
+[build]
+command = "cd exampleSite && hugo --minify --gc --themesDir .. --theme ."
+publish = "exampleSite/public"
+
+[build.environment]
+HUGO_THEME = "hugo-tufte"
diff --git a/theme.toml b/theme.toml
index f823287..df80aad 100644
--- a/theme.toml
+++ b/theme.toml
@@ -1,8 +1,8 @@
 name = "Tufte"
 license = "MIT"
-licenselink = "https://github.com/slashformotion/hugo-tufte/blob/master/LICENSE.md"
+licenselink = "https://github.com/loikein/hugo-tufte/blob/main/LICENSE.md"
 description = "A minimalist blog theme using Tufte-css."
-homepage = "https://github.com/slashformotion/hugo-tufte"
+homepage = "https://github.com/loikein/hugo-tufte"
 demo = "https://slashformotion.github.io/hugo-tufte/"
 tags = ["blog", "tufte", "minimal", 'light', "personal"]
 features = ["math", "tufte-css", "tufte"]