- 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
- git commit -m "deploy: ${GITHUB_SHA}" -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
- - name: Push changes
- uses: ad-m/github-push-action@master
- with:
- github_token: ${{ secrets.API_TOKEN_GITHUB }}
- branch: ${{ github.ref }}
- repository: hayao0819/hayao0819.github.io