Skip to content

Deploy to GitHub Pages #91

Deploy to GitHub Pages

Deploy to GitHub Pages #91

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Deploy when main branch is updated
push:
branches:
- main
paths:
- 'web/**'
- 'monkey_data/**'
- 'monkey_evolution/**'
- '.github/workflows/deploy-pages.yml'
# Also trigger after these workflows complete
workflow_run:
workflows: ["Daily Evolution", "Initialize New Monkey", "Community Scan"]
types:
- completed
branches:
- main
# Allow manual trigger
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
actions: read
# Only allow one deployment at a time
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
# Re-fetch to get the latest commit after workflow_run trigger
- name: Get latest changes
run: |
git fetch origin main
git checkout main
git pull origin main
- name: Copy data files to web folder
run: |
# Copy monkey_data to web folder so it's accessible
cp -r monkey_data web/monkey_data
# Copy monkey_evolution for timeline (if exists)
if [ -d "monkey_evolution" ]; then
cp -r monkey_evolution web/monkey_evolution
echo "πŸ“ Copied monkey_evolution to web folder"
fi
echo "πŸ“ Copied monkey_data to web folder"
echo "πŸ“‹ Web folder contents:"
ls -la web/
- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'web'
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Show deployment URL
run: |
echo "🌐 Deployed to: ${{ steps.deployment.outputs.page_url }}"
echo "🐡 Your monkey is now live!"