Merge pull request #124 from WFST/wwy #151
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: Auto Deploy hugo | |
on: #[push,workflow_dispatch] | |
push: | |
branches: | |
- "master" | |
jobs: | |
Explore-GitHub-Actions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Config private key | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.ACTIONS_PRIVATE_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
echo "StrictHostKeyChecking no" >> ~/.ssh/config | |
- name: Clone repo and push | |
env: | |
SRC_REPO: "git@github.com:WFST/wfst_hugo.git" | |
DIST_REPO: "git@git.lug.ustc.edu.cn:wfst-website/wfst-hugo.git" | |
run: | | |
git clone --mirror "$SRC_REPO" | |
cd `basename "$SRC_REPO"` | |
git remote set-url --push origin "$DIST_REPO" | |
git push --mirror | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.91.2' | |
extended: true | |
- name: Build | |
run: hugo -b "https://wfst.github.io/" --minify --gc | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.PERSONAL_TOKEN }} # secret 中设置好私钥 | |
external_repository: WFST/wfst.github.io # Page 仓库 | |
publish_branch: gh-pages # Page 仓库的分支 | |
publish_dir: ./public # 静态网页路径 | |
commit_message: ${{ github.event.head_commit.message }} |