Skip to content

Build and Deploy to GitHub Pages #165

Build and Deploy to GitHub Pages

Build and Deploy to GitHub Pages #165

Workflow file for this run

name: Build and Deploy to GitHub Pages
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allow manual triggering
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
env:
CI: true
name: Build and Deploy Job
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- uses: actions/cache/restore@v3
with:
path: .cache/
key: fetch-data-${{ github.repository_owner }}-${{ github.run_id }}
restore-keys: |
fetch-data-${{ github.repository_owner }}-
- name: Fetch Repos
run: npm run fetch-data ${{ github.repository_owner }} -- --debug
if: github.repository != 'ProjectDepot/SrcGallery' || ${{ github.event.act }} # fetch data during local testing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache/save@v3
if: success()
with:
path: .cache/
key: fetch-data-${{ github.repository_owner }}-${{ github.run_id }}
- name: Build SrcGallery
run: npm run build
if: github.repository != 'ProjectDepot/SrcGallery' || ${{ github.event.act }}
env:
VITE_GITHUB_ACTOR: ${{ github.repository_owner }}
- name: Build Docs
run: npm run docs:build
if: github.repository == 'ProjectDepot/SrcGallery' && ${{ !github.event.act }} # skip docs during local testing
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ !github.event.act }} # skip during local actions testing
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ github.repository == 'ProjectDepot/SrcGallery' && './docs/.vitepress/dist' || './dist' }}