From 1d331ef252c19d9febc7249146125a72b859dc1e Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Mon, 21 Jul 2025 13:33:11 -0400 Subject: [PATCH 01/11] Hugo deployment test run. --- .gitea/workflows/hugo_site_deployment.yml | 164 +++++++++++++++++++--- 1 file changed, 147 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index d282eb7..aa37247 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -1,36 +1,159 @@ name: Deploy Hugo Site - +env: + FLARECTL_VERSION: '0.115.0' + HC_VAULT_VERSION: '1.20.0' + TEA_VERSION: '0.10.1' on: + workflow_dispatch: push: - branches: - - main - + branches-ignore: + - 'main' + paths: + - '**.md' + - '**.toml' + - '**.html' + - '**.yml' jobs: + check-and-create-pr: + if: github.ref != 'refs/heads/main' + name: Check and Create PR + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Cache tea CLI + id: cache-tea + uses: actions/cache@v4 + with: + path: /opt/hostedtoolcache/tea/${{ env.TEA_VERSION }}/x64 + key: tea-${{ runner.os }}-${{ env.TEA_VERSION }} + - name: Install tea + uses: supplypike/setup-bin@v4 + with: + uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64 + name: tea + version: ${{ env.TEA_VERSION }} + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: PR Check' + notification_message: 'Checking for existing PR... 🔍' + - name: Check if open PR exists + id: check-opened-pr-step + continue-on-error: true + run: | + tea login add --name gitea-rinoa --url "${{ secrets.RINOA_GITEA_URL }}" --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }} + pr_exists=$(tea pr list --repo ${{ github.repository }} --state open fields-- index,title,head | egrep '\[HUGO\].*${{ github.ref_name }}' | tail -1 | wc -l) + echo "exists=$pr_exists" >> $GITHUB_OUTPUT + - name: Create PR + if: ${{ steps.check-opened-pr-step.outputs.exists == '0' }} + run: | + tea login default gitea-rinoa + pr_index_old=$(tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head --output csv | sed -e 's|"||g' | egrep '^[0-9]' | head -1 | awk -F"," '{print $1}') + pr_index_new=$(expr ${pr_index_old} + 1) + tea pr c -r ${{ github.repository }} -t "[HUGO] Automated PR for ${{ github.ref_name }} - #${pr_index_new}" -d "Automatically created PR for branch: ${{ github.ref_name }}" -a ${{ github.actor }} -L "Docker Compose" + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: PR Check' + notification_message: 'PR Created 🎟️' + hugo-sanity-check: + name: Hugo Sanity Check + needs: [check-and-create-pr] + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + submodules: true + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: Hugo' + notification_message: 'Starting link inspectionn... 🔍' + - name: Hugo Broken Link Check + uses: marccampbell/hugo-linkcheck-action@v0.1.3 + env: + HUGO_ACTION_COMMENT: true + HUGO_STARTUP_WAIT: 15 + # HUGO_EXCLUSIONS_LIST: + HUGO_CONFIG: ./config + HUGO_ROOT: ./ + HUGO_CONTENT_ROOT: ./content + # HUGO_FINAL_URL: + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: Hugo' + notification_message: 'Broken link inspection done... 🔍' + pr-merge: + name: PR Merge + needs: [hugo-sanity-check] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Cache tea CLI + id: cache-tea + uses: actions/cache@v4 + with: + path: /opt/hostedtoolcache/tea/${{ env.TEA_VERSION }}/x64 + key: tea-${{ runner.os }}-${{ env.TEA_VERSION }} + - name: Install tea + uses: supplypike/setup-bin@v4 + with: + uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64 + name: tea + version: ${{ env.TEA_VERSION }} + - name: PR Merge + id: pr_merge + run: | + tea login add --name gitea-rinoa --url ${{ secrets.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }} + tea login default gitea-rinoa + echo "Merging PR..." + pr_index=$(tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state --output csv | egrep ${{ github.ref_name }} | awk -F"," '{print $1}' | sed -e 's|"||g') + tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index} + echo "pr_index=${pr_index}" >> $GITHUB_OUTPUT + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: PR Merge Successful' + notification_message: 'PR #${{ steps.pr_mesubrge.outputs.pr_index }} merged.' deploy-hugo-site: name: Build and Deploy to Server runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - + with: + submodules: true - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: "latest" extended: true - - - name: Build Hugo Site - run: hugo --minify - - - name: Deploy to Server via SSH - uses: appleboy/scp-action@v0.1.7 + - name: Generate and deploy website + uses: ronvanderheijden/hugo-rsync-deployment@master + env: + VPS_DEPLOY_KEY: ${{ secrets.VPS_DEPLOY_KEY }} + VPS_DEPLOY_USER: ${{ secrets.HUGO_DEPLOY_USERNAME }} + VPS_DEPLOY_HOST: ${{ secrets.HUGO_SITE_HOST }} + VPS_DEPLOY_DEST: /home/charish/.docker/config/appdata/hugo with: - host: ${{ secrets.HUGO_SITE_HOST }} - username: ${{ secrets.HUGO_DEPLOY_USERNAME }} - password: ${{ secrets.HUGO_DEPLOY_PASSWORD }} - source: "public/" - target: "${{ secrets.HUGO_SITE_LOCATION }}/" - + hugo-arguments: '--minify' + rsync-arguments: '--archive --dry-run --compress --xattrs --delete' - name: Restart Hugo Container (Optional) uses: appleboy/ssh-action@v1.0.3 with: @@ -39,3 +162,10 @@ jobs: password: ${{ secrets.HUGO_DEPLOY_PASSWORD }} script: | docker restart hugo + - name: Gotify Notification + uses: eikendev/gotify-action@master + with: + gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' + gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' + notification_title: 'GITEA: Hugo' + notification_message: 'Hugo deployment successful!' \ No newline at end of file -- 2.52.0 From 014c77e813c406cf8e88fbe69fdb7dea210a9e27 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Mon, 21 Jul 2025 13:36:00 -0400 Subject: [PATCH 02/11] Hugo deployment test run. --- .gitea/workflows/hugo_site_deployment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index aa37247..37eddf9 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -133,6 +133,7 @@ jobs: notification_message: 'PR #${{ steps.pr_mesubrge.outputs.pr_index }} merged.' deploy-hugo-site: name: Build and Deploy to Server + needs: [hugo-sanity-check, pr-merge] runs-on: ubuntu-latest steps: - name: Checkout Repository -- 2.52.0 From a9ae88fd357a215af19ecb853326d5000d18b53f Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Mon, 21 Jul 2025 13:58:25 -0400 Subject: [PATCH 03/11] Workflow edit. --- .gitea/workflows/hugo_site_deployment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index 37eddf9..f14a4a3 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -84,7 +84,6 @@ jobs: env: HUGO_ACTION_COMMENT: true HUGO_STARTUP_WAIT: 15 - # HUGO_EXCLUSIONS_LIST: HUGO_CONFIG: ./config HUGO_ROOT: ./ HUGO_CONTENT_ROOT: ./content -- 2.52.0 From 1146d6d1d030f1379c5de2bc916fc62ee1c934a2 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 07:28:55 -0400 Subject: [PATCH 04/11] Adding package.json. --- package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..9edda86 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "hugo-it-services", + "private": true, + "hugo-bin": { + "buildTags": "extended" + }, + "devDependencies": { + "hugo-bin": "0.148.0" + } +} \ No newline at end of file -- 2.52.0 From acba143df687e5dae11a27685e10de27de0891c2 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 07:28:55 -0400 Subject: [PATCH 05/11] Tweaking workflow. --- .gitea/workflows/hugo_site_deployment.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index f14a4a3..b6f330e 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -79,15 +79,12 @@ jobs: gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' notification_title: 'GITEA: Hugo' notification_message: 'Starting link inspectionn... 🔍' - - name: Hugo Broken Link Check - uses: marccampbell/hugo-linkcheck-action@v0.1.3 - env: - HUGO_ACTION_COMMENT: true - HUGO_STARTUP_WAIT: 15 - HUGO_CONFIG: ./config - HUGO_ROOT: ./ - HUGO_CONTENT_ROOT: ./content - # HUGO_FINAL_URL: + - name: Broken Link check + uses: BoundfoxStudios/action-hugo-link-check@v2 + with: + hugo-root: ./ + hugo-content-dir: ./content + hugo-config: ./config/ - name: Gotify Notification uses: eikendev/gotify-action@master with: -- 2.52.0 From 682917897987c9c9e28677b86d568ef03e51bc0d Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 08:20:24 -0400 Subject: [PATCH 06/11] Generating package json files... --- package-lock.json | 13 +++++++++++++ package.json | 24 ++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..6a2c2ff --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "hugo_it-services", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hugo_it-services", + "version": "1.0.0", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json index 9edda86..3e57bde 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,22 @@ { - "name": "hugo-it-services", - "private": true, + "name": "hugo_it-services", + "version": "1.0.0", + "description": "", + "main": "index.js", "hugo-bin": { "buildTags": "extended" }, - "devDependencies": { - "hugo-bin": "0.148.0" - } -} \ No newline at end of file + "devDependencies": { + "hugo-bin": "0.148.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://git.trez.wtf/Trez.One/hugo_it-services.git" + }, + "keywords": [], + "author": "", + "license": "ISC" +} -- 2.52.0 From 976ffe905824dcb6560b9150fb8538db3b97c2e2 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 08:47:54 -0400 Subject: [PATCH 07/11] Adding step for installng Hugo. --- .gitea/workflows/hugo_site_deployment.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index b6f330e..5441f10 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -79,6 +79,15 @@ jobs: gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' notification_title: 'GITEA: Hugo' notification_message: 'Starting link inspectionn... 🔍' + - name: Install Hugo + uses: peaceiris/actions-hugo@v3.0.0 + with: + hugo-version: '0.148.0' + extended: true + - name: Verify Hugo install + run: | + hugo env + hugo version - name: Broken Link check uses: BoundfoxStudios/action-hugo-link-check@v2 with: -- 2.52.0 From 3df0192cef315f2c0fa5e8fe6f47c7e27cde9d8c Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 08:55:24 -0400 Subject: [PATCH 08/11] ... --- .gitea/workflows/hugo_site_deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index 5441f10..a551713 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -82,7 +82,7 @@ jobs: - name: Install Hugo uses: peaceiris/actions-hugo@v3.0.0 with: - hugo-version: '0.148.0' + hugo-version: '0.148.1' extended: true - name: Verify Hugo install run: | -- 2.52.0 From d860de737fbae965f9f518b417fb77cf54f8751a Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 08:57:22 -0400 Subject: [PATCH 09/11] ... --- .gitea/workflows/hugo_site_deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index a551713..0c5b773 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -82,8 +82,8 @@ jobs: - name: Install Hugo uses: peaceiris/actions-hugo@v3.0.0 with: - hugo-version: '0.148.1' - extended: true + hugo-version: 'latest' + # extended: true - name: Verify Hugo install run: | hugo env -- 2.52.0 From 17ca3a643851ed27acdd4c96a7b0b34c7493c528 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 09:02:10 -0400 Subject: [PATCH 10/11] ... --- .gitea/workflows/hugo_site_deployment.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index 0c5b773..ae999d3 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -13,6 +13,7 @@ on: - '**.toml' - '**.html' - '**.yml' + - '**.json' jobs: check-and-create-pr: if: github.ref != 'refs/heads/main' diff --git a/package.json b/package.json index 3e57bde..7b8d298 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "buildTags": "extended" }, "devDependencies": { - "hugo-bin": "0.148.0" + "hugo-bin": "v0.148.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" -- 2.52.0 From b9f301cdec6923bc280ff8dabf27e346f24546c0 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 22 Jul 2025 09:22:42 -0400 Subject: [PATCH 11/11] ... --- .gitea/workflows/hugo_site_deployment.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/hugo_site_deployment.yml b/.gitea/workflows/hugo_site_deployment.yml index ae999d3..ecb7264 100644 --- a/.gitea/workflows/hugo_site_deployment.yml +++ b/.gitea/workflows/hugo_site_deployment.yml @@ -89,12 +89,17 @@ jobs: run: | hugo env hugo version - - name: Broken Link check - uses: BoundfoxStudios/action-hugo-link-check@v2 + - name: Linkinator + uses: JustinBeckwith/linkinator-action@v1.11.0 with: - hugo-root: ./ - hugo-content-dir: ./content - hugo-config: ./config/ + recurse: true + markdown: true + # - name: Broken Link check + # uses: BoundfoxStudios/action-hugo-link-check@v2 + # with: + # hugo-root: ./ + # hugo-content-dir: ./content + # hugo-config: ./config/ - name: Gotify Notification uses: eikendev/gotify-action@master with: -- 2.52.0