run build.py #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: run build.py | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 12 * * *' | |
env: | |
GIT_USER: xiaolin2004 # change to yourself | |
GIT_EMAIL: [email protected] # change to yourself | |
THEME_REPO: lfkdsk/hexo-theme-type | |
THEME_BRANCH: main | |
TEMPLATE_REPO: lfkdsk/album_template | |
TEMPLATE_BRANCE: main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: secrets | |
steps: | |
- name: Checkout template repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.TEMPLATE_REPO }} | |
ref: ${{ env.TEMPLATE_BRANCE }} | |
- name: Checkout gallery repo | |
uses: actions/checkout@v2 | |
with: | |
path: gallery | |
- name: Checkout public repo | |
uses: actions/checkout@v2 | |
continue-on-error: true # allow error. | |
with: | |
ref: gh-pages | |
path: public | |
- name: Checkout thumbnail repo | |
uses: actions/checkout@v2 | |
continue-on-error: true # allow error. | |
with: | |
ref: thumbnail | |
path: thumbnail_public | |
- name: Checkout theme repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.THEME_REPO }} | |
ref: ${{ env.THEME_BRANCH }} | |
path: themes/hexo-theme-type | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' # caching pip dependencies | |
- run: pip install -r requirements.txt | |
- name: Generate Doc | |
run: | | |
echo $BASE_URL | |
python build.py | |
cat new_config.yml | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install Dependencies & Build | |
run: | | |
npm ci | |
npm install hexo-cli -g | |
hexo g --config new_config.yml | |
ls ./public | |
- name: Deploy Thumbnail | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./thumbnail_public | |
publish_branch: thumbnail | |
github_token: ${{ secrets.GH_PAGES_DEPLOY }} | |
user_name: ${{ env.GIT_USER }} | |
user_email: ${{ env.GIT_EMAIL }} | |
commit_msg: ${{ github.event.head_commit.message }} | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./public | |
github_token: ${{ secrets.GH_PAGES_DEPLOY }} | |
user_name: ${{ env.GIT_USER }} | |
user_email: ${{ env.GIT_EMAIL }} | |
commit_msg: ${{ github.event.head_commit.message }} |