From b13273e4683b0802c4193cafc5aaa32ef7348741 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Mon, 27 Feb 2023 16:08:29 +0000
Subject: [PATCH] update module

---
 exampleSite/.github/workflows/agolia-update.yaml |    5 +-
 exampleSite/dist/.gitkeep                        |    0 
 exampleSite/go.mod                               |    2 
 exampleSite/.github/workflows/aws-deploy.yaml    |   22 +++++-----
 .github/workflows/aws-deploy.yaml                |   26 ++++++------
 dist/.gitkeep                                    |    0 
 .github/workflows/agolia-update.yaml             |   11 +++--
 exampleSite/go.sum                               |   10 +++++
 8 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/.github/workflows/agolia-update.yaml b/.github/workflows/agolia-update.yaml
index d7e5cee..98e6b20 100644
--- a/.github/workflows/agolia-update.yaml
+++ b/.github/workflows/agolia-update.yaml
@@ -1,6 +1,6 @@
-name: Update Algolia Search Index
+name: UPDATE ALGOLIA INDEX
 
-off: # change to `on:` to turn on
+on:
   workflow_dispatch:
     branches:
     - main
@@ -31,7 +31,7 @@
         extended: true
 
     - name: Build
-      run: hugo -e "production" -d "dist" --minify
+      run: hugo -e "production" -d "dist" -s "exampleSite" --minify
     # If build succeeds, store the dist/ dir as an artifact to be used in subsequent phases.
     - name: Upload output dist dir as artifact
       uses: actions/upload-artifact@v1
@@ -63,9 +63,10 @@
       run: |
         git config --local user.email "action@github.com"
         git config --local user.name "GitHub Action"
-        git add -A dist/
-        commit_message=$(git commit -m "Publish generated Hugo site." -a | tr -d '\n' || true)
+        git add -A dist/index.json
+        commit_message=$(git commit -m "Build search index." -a | tr -d '\n' || true)
         echo "commit_message=$commxit_message >> $GITHUB_OUTPUT"
+
     # Checks if previous stage had any valid commit.
     - name: Nothing to commit
       id: nothing_committed
diff --git a/.github/workflows/aws-deploy.yaml b/.github/workflows/aws-deploy.yaml
index 5905c00..3e440fc 100644
--- a/.github/workflows/aws-deploy.yaml
+++ b/.github/workflows/aws-deploy.yaml
@@ -5,14 +5,14 @@
 # AWS_S3_BUCKET_NAME
 # AWS_SECRET_ACCESS_KEY
 
-name: CI
-off: # change to `on:` to turn on
+name: AWS DEPLOY CI
+on: # change to `on:` to turn on
   workflow_dispatch:
     branches:
-    - main
+    - production # change to 'main' to automate
   push:
     paths:
-      - exampleSite/content/**/*
+      # - exampleSite/content/**/*
       - exampleSite/config.toml
   # pull_request:
   #   branches:
@@ -42,15 +42,15 @@
         extended: true
 
     - name: Build
-      run: hugo -e "production" --minify
-    # If build succeeds, store the public/ dir as an artifact to be used in subsequent phases.
+      run: hugo -e "production" -d "dist" -s "exampleSite" --minify
+    # If build succeeds, store the dist/ dir as an artifact to be used in subsequent phases.
     - name: Upload output public dir as artifact
       uses: actions/upload-artifact@v1
       with:
         name: public
-        path: public/
+        path: dist/
   publish:
-  # In the publish phase, the site is pushed up to a different branch which only stores the public/ folder ("site" branch) and is also delta synchronized to the S3 bucket. CloudFront invalidation happens last.
+  # In the publish phase, the site is pushed up to a different branch which only stores the dist/ folder ("site" branch) and is also delta synchronized to the S3 bucket. CloudFront invalidation happens last.
     runs-on: ubuntu-20.04
     needs: build
     steps:
@@ -61,12 +61,12 @@
         submodules: true
         fetch-depth: 0
         ref: ${{ env.SITE-BRANCH }}
-    # Download the artifact containing the newly built site. This overwrites the public/ dir from the check out above.
+    # Download the artifact containing the newly built site. This overwrites the dist/ dir from the check out above.
     - name: Download artifact from build stage
       uses: actions/download-artifact@v1
       with:
         name: public
-    # Add all the files/changes in public/ that were pulled down from the build stage and then commit them.
+    # Add all the files/changes in dist/ that were pulled down from the build stage and then commit them.
     # The final line sets a GitHub Action output value that can be read by other steps.
     # This function cannot store mult-line values so newline chars must be stripped.
     - name: Commit files
@@ -74,7 +74,7 @@
       run: |
         git config --local user.email "action@github.com"
         git config --local user.name "GitHub Action"
-        git add -A public/
+        git add -A dist/
         commit_message=$(git commit -m "Publish generated Hugo site." -a | tr -d '\n' || true)
         echo "commit_message=$commit_message >> $GITHUB_OUTPUT"
     # Checks if previous stage had any valid commit.
@@ -99,7 +99,7 @@
         aws-region: ${{ env.AWS-DEFAULT-REGION }}
     - name: Delta sync site to S3 with aws cli
       if: steps.nothing_committed.conclusion == 'skipped'
-      run: aws s3 sync --size-only --delete --exclude "/authors/*/page/*" --cache-control max-age=2592000 public/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
+      run: aws s3 sync --size-only --delete --exclude "/authors/*/page/*" --cache-control max-age=2592000 dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
     # Use s5cmd to perform only a delta sync to the destination S3 bucket. This minimizes transfer traffic since it only uploads changed files.
     # - name: Delta sync site to S3 bucket
     #   if: steps.nothing_committed.conclusion == 'skipped'
@@ -111,7 +111,7 @@
     #     echo "****Showing working dir and listing files.****"
     #     pwd && ls -lah
     #     echo "****Running delta sync against S3.****"
-    #     s5cmd cp -s -n -u public/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
+    #     s5cmd cp -s -n -u dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
     # Use the aws cli tool to perform a glob invalidation of the entire site against CloudFront.
     - name: Invalidate cache on CloudFront
       if: steps.nothing_committed.conclusion == 'skipped'
diff --git a/dist/.gitkeep b/dist/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/dist/.gitkeep
diff --git a/exampleSite/.github/workflows/agolia-update.yaml b/exampleSite/.github/workflows/agolia-update.yaml
index 1e09f57..d9af2fe 100644
--- a/exampleSite/.github/workflows/agolia-update.yaml
+++ b/exampleSite/.github/workflows/agolia-update.yaml
@@ -64,9 +64,10 @@
       run: |
         git config --local user.email "action@github.com"
         git config --local user.name "GitHub Action"
-        git add -A dist/
-        commit_message=$(git commit -m "Publish generated Hugo site." -a | tr -d '\n' || true)
+        git add -A exampleSite/dist/index.json
+        commit_message=$(git commit -m "Build search index." -a | tr -d '\n' || true)
         echo "commit_message=$commxit_message >> $GITHUB_OUTPUT"
+
     # Checks if previous stage had any valid commit.
     - name: Nothing to commit
       id: nothing_committed
diff --git a/exampleSite/.github/workflows/aws-deploy.yaml b/exampleSite/.github/workflows/aws-deploy.yaml
index f634028..4ff3112 100644
--- a/exampleSite/.github/workflows/aws-deploy.yaml
+++ b/exampleSite/.github/workflows/aws-deploy.yaml
@@ -5,7 +5,7 @@
 # AWS_S3_BUCKET_NAME
 # AWS_SECRET_ACCESS_KEY
 
-name: CI
+name: AWS DEPLOY CI
 off: # change to `on:` to turn on
   workflow_dispatch:
     branches:
@@ -42,15 +42,15 @@
         extended: true
 
     - name: Build
-      run: hugo -e "production" --minify
-    # If build succeeds, store the public/ dir as an artifact to be used in subsequent phases.
+      run: hugo -e "production" -d "dist" --minify
+    # If build succeeds, store the dist/ dir as an artifact to be used in subsequent phases.
     - name: Upload output public dir as artifact
       uses: actions/upload-artifact@v1
       with:
-        name: public
-        path: public/
+        name: dist
+        path: dist/
   publish:
-  # In the publish phase, the site is pushed up to a different branch which only stores the public/ folder ("site" branch) and is also delta synchronized to the S3 bucket. CloudFront invalidation happens last.
+  # In the publish phase, the site is pushed up to a different branch which only stores the dist/ folder ("site" branch) and is also delta synchronized to the S3 bucket. CloudFront invalidation happens last.
     runs-on: ubuntu-20.04
     needs: build
     steps:
@@ -61,12 +61,12 @@
         submodules: true
         fetch-depth: 0
         ref: ${{ env.SITE-BRANCH }}
-    # Download the artifact containing the newly built site. This overwrites the public/ dir from the check out above.
+    # Download the artifact containing the newly built site. This overwrites the dist/ dir from the check out above.
     - name: Download artifact from build stage
       uses: actions/download-artifact@v1
       with:
         name: public
-    # Add all the files/changes in public/ that were pulled down from the build stage and then commit them.
+    # Add all the files/changes in dist/ that were pulled down from the build stage and then commit them.
     # The final line sets a GitHub Action output value that can be read by other steps.
     # This function cannot store mult-line values so newline chars must be stripped.
     - name: Commit files
@@ -74,7 +74,7 @@
       run: |
         git config --local user.email "action@github.com"
         git config --local user.name "GitHub Action"
-        git add -A public/
+        git add -A dist/
         commit_message=$(git commit -m "Publish generated Hugo site." -a | tr -d '\n' || true)
         echo "commit_message=$commit_message >> $GITHUB_OUTPUT"
     # Checks if previous stage had any valid commit.
@@ -99,7 +99,7 @@
         aws-region: ${{ env.AWS-DEFAULT-REGION }}
     - name: Delta sync site to S3 with aws cli
       if: steps.nothing_committed.conclusion == 'skipped'
-      run: aws s3 sync --size-only --delete --exclude "/authors/*/page/*" --cache-control max-age=2592000 public/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
+      run: aws s3 sync --size-only --delete --exclude "/authors/*/page/*" --cache-control max-age=2592000 dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
     # Use s5cmd to perform only a delta sync to the destination S3 bucket. This minimizes transfer traffic since it only uploads changed files.
     # - name: Delta sync site to S3 bucket
     #   if: steps.nothing_committed.conclusion == 'skipped'
@@ -111,7 +111,7 @@
     #     echo "****Showing working dir and listing files.****"
     #     pwd && ls -lah
     #     echo "****Running delta sync against S3.****"
-    #     s5cmd cp -s -n -u public/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
+    #     s5cmd cp -s -n -u dist/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}
     # Use the aws cli tool to perform a glob invalidation of the entire site against CloudFront.
     - name: Invalidate cache on CloudFront
       if: steps.nothing_committed.conclusion == 'skipped'
diff --git a/exampleSite/dist/.gitkeep b/exampleSite/dist/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/exampleSite/dist/.gitkeep
diff --git a/exampleSite/go.mod b/exampleSite/go.mod
index 4f11cc8..e02972a 100644
--- a/exampleSite/go.mod
+++ b/exampleSite/go.mod
@@ -2,4 +2,4 @@
 
 go 1.15
 
-require github.com/onweru/compose v0.0.0-20230227150742-c1cd743bef20 // indirect
+require github.com/onweru/compose v0.0.0-20230227160406-7a0c82ecac27 // indirect
diff --git a/exampleSite/go.sum b/exampleSite/go.sum
index ea2ccec..50799bf 100644
--- a/exampleSite/go.sum
+++ b/exampleSite/go.sum
@@ -228,3 +228,13 @@
 github.com/onweru/compose v0.0.0-20230221212524-c5ec185f96a4/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
 github.com/onweru/compose v0.0.0-20230227150742-c1cd743bef20 h1:iM4yVnHpMucPUpEoF5fyR/C7A2ymSTEIju7Razawz2g=
 github.com/onweru/compose v0.0.0-20230227150742-c1cd743bef20/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
+github.com/onweru/compose v0.0.0-20230227151701-8260c6417019 h1:HD1Ps3bk7UzO+oGQsWwdnL2z+KZ0R3wyAqyEPtW4sho=
+github.com/onweru/compose v0.0.0-20230227151701-8260c6417019/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
+github.com/onweru/compose v0.0.0-20230227154944-e2c5cbcf2024 h1:2Nbbj4EzqDfTKoGymGbQ5d/H7x9i/jAbB3OL0RqkXPQ=
+github.com/onweru/compose v0.0.0-20230227154944-e2c5cbcf2024/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
+github.com/onweru/compose v0.0.0-20230227155137-eb77723319bc h1:B3ZZwUfwP8q6I2RSbYhcekuWUma8N3UR1wNBlMYoWeE=
+github.com/onweru/compose v0.0.0-20230227155137-eb77723319bc/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
+github.com/onweru/compose v0.0.0-20230227155847-02921766d596 h1:rzph2g4FKCka+zeI5rNClE1+xxtqb4NCij4UlrdjEC4=
+github.com/onweru/compose v0.0.0-20230227155847-02921766d596/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=
+github.com/onweru/compose v0.0.0-20230227160406-7a0c82ecac27 h1:D8931rlc0KXkddIoN5Ls3CyvAeLCvvn5XBTYbaVoXfg=
+github.com/onweru/compose v0.0.0-20230227160406-7a0c82ecac27/go.mod h1:tf1kQIBUcwJ/3mRFU5eiMrMvsDScVTK2IEFsZE3hZOc=

--
Gitblit v1.10.0