Skip to content

Build Hugo and Deploy #2088

Build Hugo and Deploy

Build Hugo and Deploy #2088

Workflow file for this run

name: Build Hugo and Deploy
on:
push:
branches:
- main
# schedule:
# - cron: 0 16 * * *
workflow_dispatch:
repository_dispatch:
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- uses: actions/checkout@v3
with:
submodules: false
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Build Hugo
run: |
rm themes/DoIt -rf
git clone https://github.com/eallion/hugo-theme-doit.git themes/DoIt --single-branch
hugo --cleanDestinationDir --forceSyncStatic --gc --ignoreCache --minify --enableGitInfo
- name: Ready for Next.js
run: |
mkdir next
cp public next/public -rf
cp pages next/pages -rf
cp vercel.json next/
cp next.config.js next/
cp package.json next/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.personal_token }}
external_repository: eallion/eallion.com
publish_branch: vercel
publish_dir: ./next
# destination_dir: public
allow_empty_commit: true
# commit_message: ${{ GitHub.event.head_commit.message }}
full_commit_message: ${{ github.event.head_commit.message }}
#cname: eallion.com
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Algolia uploader
uses: wangchucheng/algolia-uploader@master
with:
app_id: ${{ secrets.ALGOLIA_APPID }}
admin_key: ${{ secrets.ALGOLIA_ADMIN_KEY }}
index_name: eallion
index_file_path: public/index.json
- name: Algolia uploader English
uses: wangchucheng/algolia-uploader@master
with:
app_id: ${{ secrets.ALGOLIA_APPID }}
admin_key: ${{ secrets.ALGOLIA_ADMIN_KEY }}
index_name: "eallion_blog_en"
index_file_path: public/en/index.json
- name: Deploy to Aliyun OSS
uses: fangbinwei/aliyun-oss-website-action@v1
with:
accessKeyId: ${{ secrets.ACCESS_KEY_ID }}
accessKeySecret: ${{ secrets.ACCESS_KEY_SECRET }}
bucket: eallion-com
endpoint: oss-cn-shanghai.aliyuncs.com
folder: public
# exclude: |
# tmp.txt
# - name: Upload to Tencent COS
# uses: zkqiang/tencent-cos-action@v0.1.0
# with:
# args: upload -rsf --delete ./public/ /
# secret_id: ${{ secrets.SECRET_COS_ID }}
# secret_key: ${{ secrets.SECRET_COS_KEY }}
# bucket: ${{ secrets.COS_CN_BUCKET }}
# region: ap-shanghai
# - name: Tencent CDN Purge
# uses: keithnull/tencent-cloud-cdn-purge-cache@v1.0
# env:
# SECRET_ID: ${{ secrets.SECRET_COS_ID }}
# SECRET_KEY: ${{ secrets.SECRET_COS_KEY }}
# PATHS: "https://eallion.com/,https://www.eallion.com/"
# FLUSH_TYPE: "delete" # optional