OSDN Git Service

[fix] : Fixed deploy
[alterlinux/hayao.fascode.net.git] / .github / workflows / hugo.yaml
1 name: Hugo Build and Deploy
2
3 on: push
4
5 jobs:
6   gh-pages:
7     runs-on: ubuntu-latest
8     steps:
9       - name: Checkout
10         uses: actions/checkout@v2
11         with:
12           submodules: true
13           fetch-depth: 0 
14
15       # https://github.com/marketplace/actions/github-pages-action
16       - name: Setup
17         uses: peaceiris/actions-hugo@v2
18         with:
19           hugo-version: '0.88.1'
20           extended: true
21
22       - name: Build for fascode.net
23         run: bash ./update-blog.sh
24         #run: hugo --minify -D
25
26       - name: Deploy for fascode.net
27         uses: peaceiris/actions-gh-pages@v3
28         with:
29           github_token: ${{ secrets.GITHUB_TOKEN }}
30           publish_branch: public
31           publish_dir: ./
32
33       - name: Build for GitHub Pages
34         run: bash ./update-blog.sh --baseURL https://hayao0819.github.io/hayao.fascode.net/blog/
35         #run: hugo --minify -D
36
37       - name: Deploy for GitHub Pages
38         uses: peaceiris/actions-gh-pages@v3
39         with:
40           github_token: ${{ secrets.GITHUB_TOKEN }}
41           publish_branch: gh-pages
42           publish_dir: ./
43
44       - name: Setup git repogitories
45         env:
46           GH_PAGES_REPO_DEPLOY_KEY: ${{ secrets.GH_PAGES_REPO_DEPLOY_KEY }}
47         run: |
48           echo "$GH_PAGES_REPO_DEPLOY_KEY" > ~/deploy_key.pem
49           chmod 600 ~/deploy_key.pem
50           git config --global user.email "hayao@fascode.net"
51           git config --global user.name "hayao"
52           git config remote.origin.url "git@github.com:Hayao0819/hayao0819.github.io.git"
53           git checkout gh-pages
54
55       - name: Deploy pages
56         env:
57           GIT_SSH_COMMAND: ssh -i ~/deploy_key.pem -o StrictHostKeyChecking=no -F /dev/null
58         run: |
59           git add -A
60           if ! git diff --cached --quiet; then
61             git commit -m "Deploy $GITHUB_SHA by GitHub Actions"
62             git pull origin master
63             git push origin master
64           fi
65