Skip to content

Merge pull request #463 from neural-loop/taxonomies #404

Merge pull request #463 from neural-loop/taxonomies

Merge pull request #463 from neural-loop/taxonomies #404

Workflow file for this run

name: Deploy Hugo site to Pages
on:
push:
branches: ["main", "staging", "bot/*"]
permissions:
contents: read
pages: write
id-token: write
env:
HUGO_ENV: production
HUGO_VERSION: "0.163.3" # Or latest
GO_VERSION: "1.26.x"
NODE_VERSION: "24.15.0"
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install npm dependencies
run: npm ci
- name: Validate Taxonomy
run: node scripts/validateContentTaxonomy.js
- name: Enforce Coding Standards
run: |
echo "Checking for decorative comments..."
if grep -r -E "(\{\{/\*\s*---|//\s*---)" layouts/ content/ ; then
echo "Error: Decorative comments found. Please remove them."
exit 1
fi
echo "Checking for hardcoded relLangURL..."
if grep -r -E "relLangURL" layouts/ ; then
echo "Warning: Hardcoded relLangURL found. Prefer site.GetPage ... .RelPermalink."
fi
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Cache and Restore OG Images
uses: actions/cache@v4
with:
path: |
content/**/*-og-*.jpg
static/images/og-image-*.jpg
tmp/og-cache-manifest.json
key: ${{ runner.os }}-og-images-${{ hashFiles('**/content/**/index.md', '**/content/**/_index.md', 'assets/og-template/**', 'scripts/**') }}
restore-keys: |
${{ runner.os }}-og-images-
- name: Generate OG Images
run: npm run og-images
- name: Fetch GitHub Stars
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run fetch-stars
- name: Update Mission Board
env:
PAT_FOR_ISSUES: ${{ secrets.PAT_FOR_ISSUES }}
run: npm run update-mission-board
- name: Determine Base URL
id: base_url
run: |
if [[ "${{ github.repository }}" == "open-neuromorphic/open-neuromorphic.github.io" && "${{ github.ref_name }}" == "main" ]]; then
BASE_URL="https://open-neuromorphic.org/"
elif [[ "${{ github.repository }}" == "open-neuromorphic/open-neuromorphic.github.io" && "${{ github.ref_name }}" == "staging" ]]; then
BASE_URL="https://open-neuromorphic.github.io/staging-preview/"
else
REPO_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)
BASE_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/"
fi
echo "BASE_URL=${BASE_URL}" >> $GITHUB_ENV
echo "Determined baseURL: ${BASE_URL}"
- name: Build Hugo Site
run: npm run hugo-build -- --baseURL="${{ env.BASE_URL }}"
- name: Create .htaccess from template
run: |
cat .github/config/htaccess.template > public/.htaccess
echo ".htaccess created."
- name: Prevent Indexing on Non-Production Deployments
if: env.BASE_URL != 'https://open-neuromorphic.org/'
run: |
echo "Applying noindex rules for baseURL: ${{ env.BASE_URL }}"
echo "" >> public/.htaccess
echo "# Rules to prevent indexing on non-production deployments" >> public/.htaccess
echo "Header set X-Robots-Tag \"noindex, nofollow\"" >> public/.htaccess
echo "User-agent: *" > public/robots.txt
echo "Disallow: /" >> public/robots.txt
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-24.04
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4