All checks were successful
Test / test (push) Successful in 6s
How a site answers missing paths now belongs to its repository like its edge rules: bunny.toml declares [site] not_found as "default", "spa" or a page from the build such as "/404.html". The action reads and sends the table on start and finalize; the gateway validates it before the upload and applies it to the Storage Zone at finalization, recording and purging only when it changed. A deployment without [site] resets the default; older action versions leave the setting alone. The console's Settings tab only shows the applied value, and the admin API no longer sets it. The maintainer guide and llms.txt describe the setting under Configuration.
61 lines
2.1 KiB
YAML
61 lines
2.1 KiB
YAML
---
|
|
name: Deploy static site to Bunny
|
|
description: Safely synchronize a completed static website build to Bunny Storage.
|
|
|
|
inputs:
|
|
directory:
|
|
description: Directory containing the completed static build and index.html.
|
|
required: true
|
|
storage-zone:
|
|
description: Bunny Storage Zone name.
|
|
required: true
|
|
storage-endpoint:
|
|
description: Regional Bunny Storage API hostname.
|
|
required: false
|
|
default: storage.bunnycdn.com
|
|
purge-endpoint:
|
|
description: Optional trusted Gandalf deployment gateway base URL.
|
|
required: false
|
|
default: ""
|
|
edge-rules:
|
|
description: >-
|
|
Optional bunny.toml with the site's [[edge_rules]] (redirects, status
|
|
codes, headers, cache times) and [site] settings (not_found). Needs
|
|
purge-endpoint. Through the gateway, leaving it empty removes rules and
|
|
resets settings that earlier deployments declared.
|
|
required: false
|
|
default: ""
|
|
dry-run:
|
|
description: Report changes without uploading or deleting files.
|
|
required: false
|
|
default: "false"
|
|
workers:
|
|
description: Maximum concurrent Bunny Storage transfers.
|
|
required: false
|
|
default: "16"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Synchronize static build
|
|
shell: bash
|
|
env:
|
|
STATIC_SITE_DIRECTORY: ${{ inputs.directory }}
|
|
BUNNY_STORAGE_ZONE: ${{ inputs.storage-zone }}
|
|
BUNNY_STORAGE_ENDPOINT: ${{ inputs.storage-endpoint }}
|
|
BUNNY_PURGE_ENDPOINT: ${{ inputs.purge-endpoint }}
|
|
STATIC_SITE_REVISION: ${{ github.sha }}
|
|
STATIC_SITE_DRY_RUN: ${{ inputs.dry-run }}
|
|
STATIC_SITE_WORKERS: ${{ inputs.workers }}
|
|
STATIC_SITE_EDGE_RULES: ${{ inputs.edge-rules }}
|
|
run: |
|
|
set -euo pipefail
|
|
args=(bunny "$STATIC_SITE_DIRECTORY" --workers "$STATIC_SITE_WORKERS")
|
|
if [[ "$STATIC_SITE_DRY_RUN" == "true" ]]; then
|
|
args+=(--dry-run)
|
|
elif [[ "$STATIC_SITE_DRY_RUN" != "false" ]]; then
|
|
echo "dry-run must be true or false" >&2
|
|
exit 2
|
|
fi
|
|
# Forgejo and GitHub name the action's checkout differently.
|
|
python3 "${FORGEJO_ACTION_PATH:-$GITHUB_ACTION_PATH}/static_site.py" "${args[@]}"
|