From 2f8659677c7e872ddc543b95ac1ab126bd2eef2b Mon Sep 17 00:00:00 2001 From: "Chris K.Y. FUNG" <8746768+chriskyfung@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20build?= =?UTF-8?q?(jekyll):=20add=20auto-commit=20action=20to=20Jekyll=20build=20?= =?UTF-8?q?workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a step to the Jekyll build workflow to automatically commit and push changes to the 'master' branch. This ensures that the '_site' directory is updated with the latest build from the GitHub Action. --- .github/workflows/jekyll-build.yml | 43 ++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/jekyll-build.yml b/.github/workflows/jekyll-build.yml index ffb1e09b1..efb2dc33c 100644 --- a/.github/workflows/jekyll-build.yml +++ b/.github/workflows/jekyll-build.yml @@ -9,14 +9,14 @@ name: Deploy Jekyll site to Pages on: # Runs on pushes targeting the default branch push: - branches: ["remote-theme"] + branches: ["remote-theme", "build/*"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: - contents: read + contents: write pages: write id-token: write @@ -56,6 +56,25 @@ jobs: - name: Upload artifact # Automatically uploads an artifact from the './_site' directory by default uses: actions/upload-pages-artifact@v3 + - name: List files + run: | + cd ./_site + pwd + ls + # - name: Commit and push changes + # uses: stefanzweifel/git-auto-commit-action@v5 + # with: + # commit_message: "jekyll build from Action ${GITHUB_SHA}" + # branch: master + # commit_options: '--no-verify --signoff' + # repository: '.' + # file_pattern: './site/*' + # status_options: '--untracked-files=no' + # add_options: '-A' + # push_options: '--force' + # skip_dirty_check: true + # skip_fetch: false + # skip_checkout: false # Deployment job deploy: @@ -65,6 +84,20 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + - uses: actions/download-artifact@v4 + with: + name: github-pages + - name: Display structure of downloaded files + run: ls -R + # uses: stefanzweifel/git-auto-commit-action@v5 + # with: + # commit_message: "jekyll build from Action ${GITHUB_SHA}" + # branch: master + # commit_options: '--no-verify --signoff' + # repository: './site/' + # status_options: '--untracked-files=no' + # add_options: '-A' + # push_options: '--force' + # skip_dirty_check: true + # skip_fetch: true + # skip_checkout: true