diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 0000000..36a9cb2 --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,61 @@ +name: Deploy to GitHub pages + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +# 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: "gh-pages" + cancel-in-progress: false + +permissions: {} + +jobs: + build: + name: Build site + runs-on: ubuntu-latest + if: github.repository_owner == 'silverstripe' + permissions: + contents: read + steps: + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup GH pages + id: pages + uses: actions/configure-pages@v5 + + - name: Build static files + shell: bash + run: | + composer install + ./makedoc.sh + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "htdocs/" + + deploy: + name: Deploy site + needs: build + runs-on: ubuntu-latest + if: github.repository_owner == 'silverstripe' + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/conf/doctum.json b/conf/doctum.json index bf9d5c6..33f8eb9 100644 --- a/conf/doctum.json +++ b/conf/doctum.json @@ -8,6 +8,7 @@ "4": "4.x", "3": "3.x" }, + "default_version": "5", "paths": { "www": "htdocs", "cache": "data/cache", diff --git a/conf/doctum.php b/conf/doctum.php index 7051914..e16a1a7 100644 --- a/conf/doctum.php +++ b/conf/doctum.php @@ -2,13 +2,13 @@ use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; -use Doctum\Project; use Doctum\Doctum; use SilverStripe\ApiDocs\Data\ApiJsonStore; use SilverStripe\ApiDocs\Data\Config; use SilverStripe\ApiDocs\Inspections\RecipeFinder; use SilverStripe\ApiDocs\Inspections\RecipeVersionCollection; use SilverStripe\ApiDocs\RemoteRepository\SilverStripeRemoteRepository; +use SilverStripe\ApiDocs\SilverstripeProject; // Get config $config = Config::getConfig(); @@ -70,7 +70,7 @@ // Override project unset($doctum['project']); $doctum['project'] = function ($sc) { - $project = new Project($sc['store'], $sc['_versions'], array( + $project = new SilverstripeProject($sc['store'], $sc['_versions'], array( 'build_dir' => $sc['build_dir'], 'cache_dir' => $sc['cache_dir'], 'remote_repository' => $sc['remote_repository'], @@ -82,6 +82,7 @@ 'source_dir' => $sc['source_dir'], 'insert_todos' => $sc['insert_todos'], 'base_url' => $sc['base_url'], + 'favicon' => 'favicon.ico', 'footer_link' => [ 'href' => 'https://github.com/silverstripe/api.silverstripe.org', 'rel' => 'noreferrer noopener', diff --git a/conf/themes/silverstripe/404.twig b/conf/themes/silverstripe/404.twig new file mode 100644 index 0000000..812e919 --- /dev/null +++ b/conf/themes/silverstripe/404.twig @@ -0,0 +1,40 @@ + + +
+ {# NOTE: Do not put this file into the manifest.yml, as that would render it per version rather than in the base dir #} +Redirecting... if you aren't redirected automatically, click here
+ + diff --git a/conf/themes/silverstripe/main_search.twig b/conf/themes/silverstripe/main_search.twig new file mode 100644 index 0000000..d819029 --- /dev/null +++ b/conf/themes/silverstripe/main_search.twig @@ -0,0 +1,68 @@ + + + + {# NOTE: Do not put this file into the manifest.yml, as that would render it per version rather than in the base dir #} +Redirecting... if you aren't redirected automatically, click here
+ + diff --git a/conf/themes/silverstripe/manifest.yml b/conf/themes/silverstripe/manifest.yml index 1ddacca..05c8267 100644 --- a/conf/themes/silverstripe/manifest.yml +++ b/conf/themes/silverstripe/manifest.yml @@ -1,6 +1,11 @@ name: silverstripe parent: default +static: + 'images/favicon.ico': 'favicon.ico' + 'images/page-not-found.gif': 'images/page-not-found.gif' + 'css/error-styles.css': 'css/error-styles.css' + global: 'doctum.js.twig': 'doctum.js' diff --git a/errors/404.html b/errors/404.html deleted file mode 100644 index 92bab30..0000000 --- a/errors/404.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - -