From c9ff65d2939efae36f4eb309f235912c36bf7cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Fri, 10 Jan 2025 12:49:35 +0100 Subject: [PATCH] chore: add deploy action --- .github/workflows/deploy.yml | 42 +++++++++++++++++++++++++++++++ article/{01.txt => 01-welcome.md} | 0 article/02-tech.txt | 20 --------------- article/03-coolarticle.txt | 12 --------- 4 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/deploy.yml rename article/{01.txt => 01-welcome.md} (100%) delete mode 100644 article/02-tech.txt delete mode 100644 article/03-coolarticle.txt diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a61a613 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Deploy Static PHP Site + +on: + push: + branches: + - master + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the repository + - name: Checkout code + uses: actions/checkout@v3 + + # Step 2: Set up PHP (optional if your site needs specific PHP extensions) + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' # Use the PHP version your site requires + + # Step 3: Start a PHP server + - name: Start PHP server + run: php -S localhost:8000 > /dev/null 2>&1 & + + # Step 4: Wait for the server to start + - name: Wait for server + run: sleep 5 + + # Step 5: Use wget to generate static files + - name: Generate static files + run: | + mkdir static_site + wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --reject-regex '/article.*|.*@.*\..*' http://localhost:8000/ -P static_site + + # Step 6: Deploy to GitHub Pages + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./static_site/localhost\:8000 diff --git a/article/01.txt b/article/01-welcome.md similarity index 100% rename from article/01.txt rename to article/01-welcome.md diff --git a/article/02-tech.txt b/article/02-tech.txt deleted file mode 100644 index f857d58..0000000 --- a/article/02-tech.txt +++ /dev/null @@ -1,20 +0,0 @@ -TITLE:A technical article -DATE:2015 April 9th -AUTHOR:Jo - -This Python code is really good: - - def good(): - a = 1 - b = 2 - c = a + b - return None - -This one is *even better:* - - def better(): - a = 128 - b = 256 - c = a * b - return None - diff --git a/article/03-coolarticle.txt b/article/03-coolarticle.txt deleted file mode 100644 index 76050be..0000000 --- a/article/03-coolarticle.txt +++ /dev/null @@ -1,12 +0,0 @@ -TITLE:A new article -DATE:2015 April 10th -URL:coolarticle -AUTHOR:Jo - -This is a sample blog article. What to do now? -* write a new article, -* listen to [some music](http://soundcloud.com/shura/sets/shura-just-once), -* or do something else? - -![](http://gget.it/hm8jobmp/tumblr_ltjcmgHCkz1r0mxp5.jpg) -