From f2b67379605053464c000fa0dad8a85f5d75481d Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Fri, 1 May 2026 14:17:00 +0700 Subject: [PATCH] ci: add build workflow, dependabot config, and Pages deploy - build.yml: hugo extended 0.154.0, runs on PR + main push, uploads exampleSite artifact for inspection - deploy.yml: deploys exampleSite to GitHub Pages on main push using actions/configure-pages + actions/deploy-pages (modern flow, no gh-pages branch) - dependabot.yml: weekly action version updates One-time manual: enable Pages in repo settings (Source = GitHub Actions) before deploy.yml will succeed. --- themes/bonsai/.github/dependabot.yml | 11 +++++ themes/bonsai/.github/workflows/build.yml | 40 +++++++++++++++ themes/bonsai/.github/workflows/deploy.yml | 57 ++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 themes/bonsai/.github/dependabot.yml create mode 100644 themes/bonsai/.github/workflows/build.yml create mode 100644 themes/bonsai/.github/workflows/deploy.yml diff --git a/themes/bonsai/.github/dependabot.yml b/themes/bonsai/.github/dependabot.yml new file mode 100644 index 0000000..f63028d --- /dev/null +++ b/themes/bonsai/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + commit-message: + prefix: chore + include: scope diff --git a/themes/bonsai/.github/workflows/build.yml b/themes/bonsai/.github/workflows/build.yml new file mode 100644 index 0000000..6eb5b8d --- /dev/null +++ b/themes/bonsai/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: build + +on: + pull_request: + branches: [main] + push: + branches: [main] + +permissions: + contents: read + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup Hugo Extended + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.154.0' + extended: true + + - name: Build exampleSite + working-directory: exampleSite + run: hugo --gc --minify --themesDir ../.. --printPathWarnings + + - name: Upload built site + uses: actions/upload-artifact@v4 + with: + name: exampleSite-public + path: exampleSite/public + retention-days: 7 diff --git a/themes/bonsai/.github/workflows/deploy.yml b/themes/bonsai/.github/workflows/deploy.yml new file mode 100644 index 0000000..6c88852 --- /dev/null +++ b/themes/bonsai/.github/workflows/deploy.yml @@ -0,0 +1,57 @@ +name: deploy + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - id: pages + uses: actions/configure-pages@v5 + + - name: Setup Hugo Extended + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.154.0' + extended: true + + - name: Build with production baseURL + working-directory: exampleSite + run: | + hugo \ + --gc \ + --minify \ + --themesDir ../.. \ + --baseURL "${{ steps.pages.outputs.base_url }}/" + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: exampleSite/public + + deploy: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - id: deployment + uses: actions/deploy-pages@v4