-name: Hugo
+name: Hugo Build and Deploy
on: push
hugo-version: '0.88.1'
extended: true
- - name: Build
- working-directory: ./blog
- #run: ./update-blog,sh
- run: hugo --minify
+ - name: Build for fascode.net
+ run: bash ./update-blog.sh
- - name: Deploy
+ - name: Deploy for fascode.net
+ uses: peaceiris/actions-gh-pages@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_branch: public
+ publish_dir: ./
+
+ - name: Build for GitHub Pages
+ run: bash ./update-blog.sh --baseURL https://hayao0819.github.io/hayao.fascode.net/blog/
+
+ - name: Deploy for GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
+ publish_dir: ./
+
+ main-repo:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ submodules: true
+ fetch-depth: 0
+
+ - name: Setup
+ uses: peaceiris/actions-hugo@v2
+ with:
+ hugo-version: '0.88.1'
+ extended: true
+
+ - name: Build for GitHub Pages
+ run: bash ./update-blog.sh --baseURL https://hayao0819.github.io/blog/
+
+ - name: Install SSH key
+ uses: shimataro/ssh-key-action@v2
+ with:
+ key: ${{ secrets.GH_PAGES_REPO_DEPLOY_KEY }}
+ name: id_rsa # optional
+ known_hosts: unnecessary
+ - name: Commit files
+ env:
+ GH_PAGES_REPO_DEPLOY_KEY: ${{ secrets.GH_PAGES_REPO_DEPLOY_KEY }}
+ run: |
+ echo "$GH_PAGES_REPO_DEPLOY_KEY" > ~/deploy_key.pem
+ chmod 600 ~/deploy_key.pem
+ git config --local user.email "hayao@fascode.net"
+ git config --local user.name "hayao[bot]"
+ git config pull.rebase false
+ git config remote.origin.url "git@github.com:hayao0819/hayao0819.github.io.git"
+ echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
+ git add -A
+ if ! git diff --cached --quiet; then
+ git commit -m "deploy: ${GITHUB_SHA}" -a
+ else
+ echo "Nothing has been commited"
+ fi
+ git pull --allow-unrelated-histories origin master
+ git push origin master
+