update 記事を更新した。 #1647
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: Push to hatenablog | |
on: | |
push: | |
branches: | |
- release/** | |
jobs: | |
push: | |
name: push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.x | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# blogsyncをセットアップする。 | |
- name: Setup blogsync | |
env: | |
BSY: ${{ secrets.BSY }} | |
run: | | |
if !(type ~/go/bin/blogsync > /dev/null 2>&1); then | |
go install github.com/x-motemen/blogsync@v0.13.5; | |
fi | |
echo -e ${BSY} > blogsync.yaml | |
# featureブランチとmainブランチの間に差分があれば、プッシュする。 | |
- name: Exec blogsync push | |
env: | |
DOMAIN: ${{ secrets.DOMAIN }} | |
run: | | |
DIFF=$(git diff origin/main --name-only --relative dist/entry) | |
echo $DIFF | |
if [ -z "$DIFF" ] ; then | |
echo "差分がないため、GitHub Actionsを終了しました。" | |
exit 0 | |
fi | |
~/go/bin/blogsync push $DIFF |