Skip to content

Merge pull request #7 from cloudartisan/dependabot/github_actions/pea… #95

Merge pull request #7 from cloudartisan/dependabot/github_actions/pea…

Merge pull request #7 from cloudartisan/dependabot/github_actions/pea… #95

Workflow file for this run

# Version-locked deployment workflow for Hugo site with Congo theme
# Hugo 0.149.0 + Congo v2.12.2 + Go 1.25.0 for reproducible builds
name: Deploy Hugo site
on:
push:
branches:
- main # Set this to your default branch
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v5.0.0
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Extract versions from go.mod
id: versions
run: |
GO_VERSION=$(grep "^go " go.mod | awk '{print $2}')
HUGO_VERSION=$(grep "github.com/gohugoio/hugo v" go.mod | awk '{print $2}' | sed 's/v//')
echo "go_version=${GO_VERSION}.0" >> $GITHUB_OUTPUT
echo "hugo_version=${HUGO_VERSION}" >> $GITHUB_OUTPUT
echo "Using Go version: ${GO_VERSION}.0"
echo "Using Hugo version: ${HUGO_VERSION}"
- name: Setup Go
uses: actions/setup-go@v6.0.0
with:
go-version: ${{ steps.versions.outputs.go_version }}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3.0.0
with:
hugo-version: ${{ steps.versions.outputs.hugo_version }}
extended: true
- name: Debug Environment
run: |
echo "Current directory structure:"
ls -la
echo "Hugo configuration:"
cat config.yaml
echo "Hugo module configuration:"
hugo mod graph || echo "Hugo mod graph failed"
echo "Go mod configuration:"
cat go.mod || echo "No go.mod file found"
- name: Setup Hugo Modules
run: |
# Clean start - remove any existing module files that might be corrupted
rm -f go.sum
# Only initialize if go.mod doesn't exist
if [ ! -f go.mod ]; then
echo "Initializing Hugo modules..."
hugo mod init github.com/cloudartisan/cloudartisan.github.io
else
echo "go.mod already exists, using existing module configuration"
fi
# Ensure modules are up to date
hugo mod tidy
# Verify module setup
echo "Module status:"
hugo mod graph
- name: Build
run: hugo --minify --buildFuture
- name: Copy CNAME file
run: |
if [ -f "CNAME" ]; then
echo "Copying CNAME file to publish directory..."
cp CNAME public/
fi
- name: Deploy
uses: peaceiris/actions-gh-pages@v4.0.0
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: gh-pages # deploying to gh-pages branch
cname: cloudartisan.com # Explicit CNAME setting for custom domain
force_orphan: true # Force clean deployment