READMEに添付するカメラ搭載ラズパイマウス画像を更新 #100
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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
fetch-depth: '0' | |
path: 'source' | |
- name: Checkout dist | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
fetch-depth: '0' | |
path: 'dist' | |
- name: Setup Git | |
run: | | |
git config --global user.name "RT Corp." | |
git config --global user.email "[email protected]" | |
- name: Clone & Sync & Generate & Push | |
run: | | |
cd ${GITHUB_WORKSPACE}/source | |
HASH=`git rev-parse --short HEAD` | |
./generate_all_images_md.bash | |
rsync -av --delete --exclude '.*' --exclude '*.bash' ${GITHUB_WORKSPACE}/source/ ${GITHUB_WORKSPACE}/dist | |
cd ${GITHUB_WORKSPACE}/dist | |
# exit if nothing to commit | |
git status | grep -q "nothing" && echo "::debug::Nothing to 'git commit'" && exit 0 | |
# commit updated files | |
git add . | |
git commit -m "deploy: ${HASH}" | |
git push -q origin gh-pages |