Skip to content

Update publish.yaml #11

Update publish.yaml

Update publish.yaml #11

Workflow file for this run

name: Deploy website to FTP
env:
WC_HUGO_VERSION: '0.123.7'
on:
# Trigger the workflow every time you push to the `main` branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Provide permission to clone the repo and deploy it to FTP
permissions:
contents: read
id-token: write
concurrency:
group: "ftp-deployment"
cancel-in-progress: false
jobs:
# Build website
build:
if: github.repository_owner != 'HugoBlox'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch history for Hugo's .GitInfo and .Lastmod
fetch-depth: 0
node-version: 20
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.WC_HUGO_VERSION }}
extended: true
- uses: actions/cache@v3
with:
path: /tmp/hugo_cache_runner/
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
run: |
echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
hugo --minify
- name: Generate Pagefind search index
run: npx pagefind --source "public"
- name: Upload to FTP
env:
environment: FTP_SERVER
uses: pressidium/lftp-mirror-action@v1
with:
run: |
echo "${{ secrets.FTP_SERVER_ADDRESS }}, ${{ secrets.FTP_USERNAME }}"
host: ${{ secrets.FTP_SERVER_ADDRESS }}
user: ${{ secrets.FTP_USERNAME }}
pass: ${{ secrets.FTP_PASSWORD }}
port: ${{ secrets.FTP_PORT }}
settings: 'sftp:auto-confirm=yes'
localDir: "./public"
options: '--verbose'