2023-07-20 15:44:02 +00:00
|
|
|
---
|
|
|
|
name: Build GH-Pages
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2024-05-24 01:42:06 +00:00
|
|
|
branches: [master]
|
2023-07-20 15:44:02 +00:00
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
push:
|
|
|
|
branches: [master]
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
concurrency:
|
2024-05-24 01:42:06 +00:00
|
|
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
2023-07-20 15:44:02 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
update_pages:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-06 00:09:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-20 15:44:02 +00:00
|
|
|
|
|
|
|
- name: Checkout gh-pages
|
2023-09-06 00:09:25 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-20 15:44:02 +00:00
|
|
|
with:
|
|
|
|
ref: gh-pages
|
|
|
|
path: gh-pages
|
|
|
|
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
|
|
|
|
fetch-depth: 0 # otherwise, will fail to push refs to dest repo
|
|
|
|
|
|
|
|
- name: Prepare gh-pages
|
|
|
|
run: |
|
|
|
|
# empty contents
|
|
|
|
rm -f -r ./gh-pages/*
|
|
|
|
|
|
|
|
# copy template back to pages
|
|
|
|
cp -f -r ./gh-pages-template/. ./gh-pages/
|
|
|
|
|
|
|
|
- name: Upload Artifacts
|
|
|
|
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
|
2023-12-15 22:50:06 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-07-20 15:44:02 +00:00
|
|
|
with:
|
|
|
|
name: gh-pages
|
|
|
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
path: |
|
|
|
|
${{ github.workspace }}/gh-pages
|
|
|
|
!**/*.git
|
|
|
|
|
|
|
|
- name: Deploy to gh-pages
|
|
|
|
if: >-
|
|
|
|
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
|
|
|
(github.event_name == 'workflow_dispatch')
|
2024-04-19 20:03:37 +00:00
|
|
|
uses: actions-js/push@v1.5
|
2023-07-20 15:44:02 +00:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GH_BOT_TOKEN }}
|
|
|
|
author_email: ${{ secrets.GH_BOT_EMAIL }}
|
|
|
|
author_name: ${{ secrets.GH_BOT_NAME }}
|
|
|
|
directory: gh-pages
|
|
|
|
branch: gh-pages
|
|
|
|
force: false
|
|
|
|
message: sync gh-pages to ${{ github.sha }}
|