Overview
GitHub Actions
Three automated workflows handle deployment, containerization, and maintenance tasks without manual intervention.
GitHub Pages
Static site hosting directly from the repository with custom CORS configuration and automatic HTTPS.
Deployment Workflow
The main deployment workflow deploys the site to GitHub Pages whenever changes are pushed to theupdate-urls branch.
Configuration
File:.github/workflows/deploy.yml
Workflow Steps
Trigger on Push
The workflow automatically triggers when code is pushed to the
update-urls branch, ensuring only tested changes are deployed.Repository Checkout
Uses
actions/checkout@v3 to clone the repository with full git history for accurate deployment.Deploy to Pages
The
peaceiris/actions-gh-pages@v3 action publishes the ./dist directory to the gh-pages branch using a custom access token.The workflow uses Ubuntu 22.04 LTS as the runner environment, providing a stable and secure build platform.
CORS Configuration
The deployment includes automatic CORS header configuration to support the blog’s GitHub API integration.Headers File
File:dist/_headers
The
/* pattern applies these headers to all routes on the site. The wildcard origin (*) is necessary for the blog system to fetch Markdown files from the GitHub API.Why CORS Matters
The blog system (old/blog/scripts/list-posts.js) makes client-side requests to the GitHub API:
Copyright Update Workflow
An automated workflow updates copyright years across all HTML files annually.Configuration
File:.github/workflows/update-copyright.yml
How It Works
Scheduled Execution
Scheduled Execution
The cron expression
0 0 1 1 * runs the workflow at midnight UTC on January 1st every year.- Minute: 0
- Hour: 0 (midnight)
- Day: 1 (first day)
- Month: 1 (January)
- Day of week: * (any)
Copyright Pattern Matching
Copyright Pattern Matching
The workflow uses This regex matches any copyright statement starting with “Copyright © 2024-” followed by digits, updating the year to the current year.
sed to find and replace copyright patterns:Automated Commit
Automated Commit
After updating all files, the workflow:
- Configures git with Enzo Fuke’s name and noreply email
- Stages all changed files
- Creates a commit with descriptive message
- Pushes changes back to the repository
Docker Workflow
A third workflow handles Docker containerization (specific configuration not shown in provided files). File:.github/workflows/docker.yaml
This workflow likely builds and publishes a Docker image of the website, enabling containerized deployment options beyond GitHub Pages.
Deployment Architecture
Secrets and Authentication
The deployment workflow uses a custom GitHub token stored in repository secrets:Required Token Permissions
The access token should have:- Contents: Read and write access
- Workflows: Read and write access (for workflow files)
- Pages: Write access for GitHub Pages deployment
Publish Directory
The deployment publishes from the./dist directory:
- All static HTML files
- Assets (images, scripts, styles)
- Configuration files (
_headers,robots.txt)
Only files in the
./dist directory are deployed to GitHub Pages. Ensure all necessary files are present before pushing to the update-urls branch.Monitoring and Troubleshooting
Viewing Workflow Runs
Monitor deployment status in the GitHub Actions tab:- Navigate to the repository on GitHub
- Click the “Actions” tab
- Select the workflow run to view logs
Common Issues
Deployment Failure
Check that
CORS_ACCESS_TOKEN is correctly configured and has proper permissions.CORS Errors
Verify the
_headers file exists in ./dist and contains proper CORS directives.Copyright Not Updating
Ensure the workflow has push permissions and the cron schedule is correct.
Missing Files
Confirm all files are in
./dist before the workflow publishes to gh-pages.