mathieu@laptop:~/Content/Laravel$ cat build-your-statamic-static-website-via-github-actions.txt
> Title: Build your Statamic static website via GitHub actions
> Date: June 1, 2026
> Tags: Laravel, PHP
I've updated the Mikhail Kozlov's workflow to generate your Statamic static site through GitHub actions.
This GitHub Workflow removes the need to generate your site locally and let GitHub handle the generation. This also saves more space in your repository since we do not need the generated site in Git.
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
clean: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Setup npm
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Install npm dependencies
run: |
npm install
npm run build
- name: Build static assets
run: |
cp .env.example .env
php artisan key:generate
php please ssg:generate
env:
APP_ENV: production
APP_URL: https://mathieuderuiter.nl
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'storage/static'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4