From 14165e2006e6a27e8c625021f70942b1bd0d7522 Mon Sep 17 00:00:00 2001 From: Herwin Bozet Date: Tue, 26 Nov 2024 22:08:33 +0100 Subject: [PATCH] Added GitHub Pages steps, Automated demo page (#2) * Testing PHP Rendering workflow Update php-render.yml, sass-compile.yml, and nibblepoker.scss * Fixed CWD in PHP workflow Update php-render.yml * Removed beautifier step Update php-render.yml * Added artifact retrieval Update php-render.yml and sass-compile.yml * Attempt 1 to fix broken triggers Update php-render.yml * Combined workflows, Screw this noise Update build-all.yml, php-render.yml, and sass-compile.yml * Fixed paths for GitHub Pages Update index.php, intro.php, and sidebar.php * Removed trash step, Fixed last faulty path Update build-all.yml and cards.php --- .../{sass-compile.yml => build-all.yml} | 30 +++++++++++++++++-- htdocs/index.php | 14 ++++----- htdocs/parts/examples/cards.php | 2 +- htdocs/parts/intro.php | 1 + htdocs/parts/sidebar.php | 4 +-- scss/nibblepoker.scss | 6 ++-- 6 files changed, 42 insertions(+), 15 deletions(-) rename .github/workflows/{sass-compile.yml => build-all.yml} (70%) diff --git a/.github/workflows/sass-compile.yml b/.github/workflows/build-all.yml similarity index 70% rename from .github/workflows/sass-compile.yml rename to .github/workflows/build-all.yml index df8d759..1babb84 100644 --- a/.github/workflows/sass-compile.yml +++ b/.github/workflows/build-all.yml @@ -1,11 +1,11 @@ -name: Compile SASS +name: Build Everything on: push: pull_request: jobs: - deploy: + sass_compile: runs-on: ubuntu-latest permissions: @@ -21,6 +21,12 @@ jobs: submodules: true fetch-depth: 0 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + extensions: none + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -28,7 +34,7 @@ jobs: - name: Install SASS Compiler run: | - npm install -g html-minifier sass + npm install -g sass - name: Compile SASS run: | @@ -57,3 +63,21 @@ jobs: if-no-files-found: error retention-days: 90 compression-level: 9 + + - name: Pre-render PHP File + run: | + cd htdocs + php ./index.php > ./index.html + + - name: Remove trash + run: | + cd htdocs + rm -rf parts/ + rm *.php + + - name: Deploy demo page to gh-pages + uses: peaceiris/actions-gh-pages@v4 + if: ${{ github.ref == 'refs/heads/master' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./htdocs \ No newline at end of file diff --git a/htdocs/index.php b/htdocs/index.php index 8456187..14482e2 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -7,10 +7,10 @@ - - - - + + + + @@ -124,8 +124,8 @@ - - - + + + diff --git a/htdocs/parts/examples/cards.php b/htdocs/parts/examples/cards.php index 8674533..9b1c1aa 100644 --- a/htdocs/parts/examples/cards.php +++ b/htdocs/parts/examples/cards.php @@ -22,7 +22,7 @@ if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
- Hungry Kitty Cat + Hungry Kitty Cat

Hungry Cat

diff --git a/htdocs/parts/intro.php b/htdocs/parts/intro.php index 1359b33..05c7cd3 100644 --- a/htdocs/parts/intro.php +++ b/htdocs/parts/intro.php @@ -7,6 +7,7 @@ if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) { global $root_path; ?> +

Introduction

diff --git a/htdocs/parts/sidebar.php b/htdocs/parts/sidebar.php index 2fda774..e4916f8 100644 --- a/htdocs/parts/sidebar.php +++ b/htdocs/parts/sidebar.php @@ -8,9 +8,9 @@ if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {