Build the blog #97
This file contains hidden or 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: Build the blog | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- .gitignore | |
- .github/** | |
- README.md | |
- LICENSE | |
workflow_dispatch: | |
jobs: | |
build: | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get files in gh-pages | |
run: | | |
if git ls-remote --exit-code --heads origin gh-pages; then | |
git fetch origin gh-pages | |
check_item=( | |
checksum/ | |
posts/ | |
tags/ | |
backup/ | |
all-posts.html | |
all-tags.html | |
) | |
for item in "${check_item[@]}"; do | |
if git ls-tree -r origin/gh-pages --name-only | grep -q "^$item"; then | |
git checkout origin/gh-pages -- $item | |
fi | |
done | |
fi | |
- name: Build | |
run: | | |
sed --version | |
chmod +x bw.sh | |
./bw.sh b | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: . |