Testing out language translation during workflow.

This commit is contained in:
2025-07-25 10:46:03 -04:00
parent 0249a4f89b
commit 9f8a753d59
+146 -115
View File
@@ -1,7 +1,5 @@
name: Deploy Hugo Site name: Deploy Hugo Site
env: env:
FLARECTL_VERSION: '0.115.0'
HC_VAULT_VERSION: '1.20.0'
TEA_VERSION: '0.10.1' TEA_VERSION: '0.10.1'
on: on:
workflow_dispatch: workflow_dispatch:
@@ -64,132 +62,165 @@ jobs:
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: PR Check' notification_title: 'GITEA: PR Check'
notification_message: 'PR Created 🎟️' notification_message: 'PR Created 🎟️'
hugo-sanity-check: hugo-translations:
name: Hugo Sanity Check
needs: [check-and-create-pr]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
submodules: true
- name: Gotify Notification - name: Gotify Notification
uses: eikendev/gotify-action@master uses: eikendev/gotify-action@master
with: with:
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Hugo' notification_title: 'GITEA: Hugo @ Rinoa'
notification_message: 'Starting link inspectionn... 🔍' notification_message: 'Starting translations...'
- name: Install Hugo - name: GPT Translations (es,ko,zh-Hans)
uses: peaceiris/actions-hugo@v3.0.0 uses: 3ru/gpt-translate@v1.2.2
with: with:
hugo-version: 'latest' token: ${{ secrets.BOT_GITEA_TOKEN }}
# extended: true apikey: ${{ secrets.OPENAI_API_KEY }}
- name: Verify Hugo install inputFiles: ./content/en/*.md
run: | outputFiles: ./content/es/*.md ./content/ko/*.md ./content/zh-Hans/*.md
hugo env languages: Spanish Korean Chinese
hugo version - name: Add/Commit README.md
- name: Linkinator id: commit-translations
uses: JustinBeckwith/linkinator-action@v1.11.0 uses: EndBug/add-and-commit@v9
with: with:
paths: . message: "Adding translated content."
serverRoot: ./ add: './content/*'
format: json
recurse: true
markdown: true
verbosity: error
- name: Gotify Notification - name: Gotify Notification
uses: eikendev/gotify-action@master uses: eikendev/gotify-action@master
with: with:
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
notification_title: 'GITEA: Hugo' notification_title: 'GITEA: Hugo @ Rinoa'
notification_message: 'Broken link inspection done... 🔍' notification_message: 'Translations completed! Committing and continuing...'
pr-merge: # hugo-sanity-check:
name: PR Merge # name: Hugo Sanity Check
needs: [hugo-sanity-check] # needs: [check-and-create-pr]
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: Checkout # - name: Checkout Code
uses: actions/checkout@v4 # uses: actions/checkout@v4
- name: Cache tea CLI # with:
id: cache-tea # submodules: true
uses: actions/cache@v4 # - name: Gotify Notification
with: # uses: eikendev/gotify-action@master
path: /opt/hostedtoolcache/tea/${{ env.TEA_VERSION }}/x64 # with:
key: tea-${{ runner.os }}-${{ env.TEA_VERSION }} # gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
- name: Install tea # gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
uses: supplypike/setup-bin@v4 # notification_title: 'GITEA: Hugo'
with: # notification_message: 'Starting link inspectionn... 🔍'
uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64 # - name: Install Hugo
name: tea # uses: peaceiris/actions-hugo@v3.0.0
version: ${{ env.TEA_VERSION }} # with:
- name: PR Merge # hugo-version: 'latest'
id: pr_merge # # extended: true
run: | # - name: Verify Hugo install
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 }} # run: |
tea login default gitea-rinoa # hugo env
echo "Merging PR..." # hugo version
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') # - name: Linkinator
tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index} # uses: JustinBeckwith/linkinator-action@v1.11.0
echo "pr_index=${pr_index}" >> $GITHUB_OUTPUT # with:
- name: Gotify Notification # paths: .
uses: eikendev/gotify-action@master # serverRoot: ./
with: # format: json
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' # recurse: true
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' # markdown: true
notification_title: 'GITEA: PR Merge Successful' # verbosity: error
notification_message: 'PR #${{ steps.pr_mesubrge.outputs.pr_index }} merged.' # - name: Gotify Notification
deploy-hugo-site: # uses: eikendev/gotify-action@master
name: Build and Deploy to Server # with:
needs: [hugo-sanity-check, pr-merge] # gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
runs-on: ubuntu-latest # gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
steps: # notification_title: 'GITEA: Hugo'
- name: Checkout Repository # notification_message: 'Broken link inspection done... 🔍'
uses: actions/checkout@v4 # pr-merge:
with: # name: PR Merge
submodules: true # needs: [hugo-sanity-check]
- name: Setup Hugo # runs-on: ubuntu-latest
uses: peaceiris/actions-hugo@v3 # steps:
with: # - name: Checkout
hugo-version: "latest" # uses: actions/checkout@v4
extended: true # - name: Cache tea CLI
- name: Setup rsync # id: cache-tea
id: setup_rsync # uses: actions/cache@v4
uses: GuillaumeFalourd/setup-rsync@v1.2 # with:
with: # path: /opt/hostedtoolcache/tea/${{ env.TEA_VERSION }}/x64
ssh_key: ${{ secrets.VPS_DEPLOY_KEY }} # key: tea-${{ runner.os }}-${{ env.TEA_VERSION }}
- name: Gotify Notification # - name: Install tea
uses: eikendev/gotify-action@master # uses: supplypike/setup-bin@v4
with: # with:
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' # uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' # name: tea
notification_title: 'GITEA: Hugo' # version: ${{ env.TEA_VERSION }}
notification_message: 'Starting Hugo deployment... 🤞🏽' # - name: PR Merge
- name: Generate Hugo Site & Deploy for Docker # id: pr_merge
env: # run: |
VPS_DEPLOY_USER: ${{ secrets.HUGO_DEPLOY_USERNAME }} # 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 }}
VPS_DEPLOY_HOST: ${{ secrets.HUGO_SITE_HOST }} # tea login default gitea-rinoa
VPS_DEPLOY_DEST: ${{ secrets.VPS_DEPLOY_DEST }} # echo "Merging PR..."
VPS_DEPLOY_KEY: ${{ steps.setup_rsync.outputs.ssh_key_path }} # 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')
run: | # tea pr m --repo ${{ github.repository }} --title "Auto Merge of PR ${pr_index} - ${{ github.ref_name }}" --message "Merged by ${{ github.actor }}" ${pr_index}
echo "${VPS_DEPLOY_KEY}" # echo "pr_index=${pr_index}" >> $GITHUB_OUTPUT
hugo version # - name: Gotify Notification
hugo --minify --source . # uses: eikendev/gotify-action@master
rsync -e "ssh -i ${VPS_DEPLOY_KEY} -o StrictHostKeyChecking=no" -avz --progress ./public ${VPS_DEPLOY_USER}@192.168.1.254:${VPS_DEPLOY_DEST} # with:
- name: Restart Hugo Container # gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}'
uses: appleboy/ssh-action@v1.2.2 # gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}'
with: # notification_title: 'GITEA: PR Merge Successful'
host: 192.168.1.254 # notification_message: 'PR #${{ steps.pr_mesubrge.outputs.pr_index }} merged.'
username: ${{ secrets.HUGO_DEPLOY_USERNAME }} # deploy-hugo-site:
password: ${{ secrets.HUGO_DEPLOY_PASSWORD }} # name: Build and Deploy to Server
key_path: ${{ steps.setup_rsync.outputs.ssh_key_path }} # needs: [hugo-sanity-check, pr-merge]
script: | # runs-on: ubuntu-latest
docker container restart hugo # steps:
- name: Gotify Notification # - name: Checkout Repository
uses: eikendev/gotify-action@master # uses: actions/checkout@v4
with: # with:
gotify_api_base: '${{ secrets.RINOA_GOTIFY_URL }}' # submodules: true
gotify_app_token: '${{ secrets.RINOA_RUNNER_GOTIFY_TOKEN }}' # - name: Setup Hugo
notification_title: 'GITEA: Hugo' # uses: peaceiris/actions-hugo@v3
notification_message: 'Hugo deployment successful!' # with:
# hugo-version: "latest"
# extended: true
# - name: Setup rsync
# id: setup_rsync
# uses: GuillaumeFalourd/setup-rsync@v1.2
# with:
# ssh_key: ${{ secrets.VPS_DEPLOY_KEY }}
# - 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 Hugo deployment... 🤞🏽'
# - name: Generate Hugo Site & Deploy for Docker
# env:
# VPS_DEPLOY_USER: ${{ secrets.HUGO_DEPLOY_USERNAME }}
# VPS_DEPLOY_HOST: ${{ secrets.HUGO_SITE_HOST }}
# VPS_DEPLOY_DEST: ${{ secrets.VPS_DEPLOY_DEST }}
# VPS_DEPLOY_KEY: ${{ steps.setup_rsync.outputs.ssh_key_path }}
# run: |
# echo "${VPS_DEPLOY_KEY}"
# hugo version
# hugo --minify --source .
# rsync -e "ssh -i ${VPS_DEPLOY_KEY} -o StrictHostKeyChecking=no" -avz --progress ./public ${VPS_DEPLOY_USER}@192.168.1.254:${VPS_DEPLOY_DEST}
# - name: Restart Hugo Container
# uses: appleboy/ssh-action@v1.2.2
# with:
# host: 192.168.1.254
# username: ${{ secrets.HUGO_DEPLOY_USERNAME }}
# password: ${{ secrets.HUGO_DEPLOY_PASSWORD }}
# key_path: ${{ steps.setup_rsync.outputs.ssh_key_path }}
# script: |
# docker container 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!'