Merge pull request #646 from stzn/contributors-readme-action-KLH8FY9Uqs #256
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: CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-contributors: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: akhilmhdh/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update last modified dates | |
run: | | |
# 現在の日付を取得 (JST) | |
current_date=$(TZ=Asia/Tokyo date '+%Y/%m/%d') | |
# .md ファイルの最終更新日コメントを更新 | |
find . -name "*.md" -type f -exec grep -l "最終更新日" {} \; | while read file; do | |
echo "Updating date in: $file" | |
sed -i "s|<!--最終更新日: [0-9/]*[[:space:]]*-->|<!--最終更新日: $current_date -->|g" "$file" | |
done | |
# 変更があった場合のみコミット | |
if ! git diff --quiet; then | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "自動更新: 最終更新日を $current_date に更新" | |
git push | |
else | |
echo "No changes to commit" | |
fi | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "latest" | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Build Honkit | |
run: yarn build | |
- name: Push to gh-pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh-pages | |
publish_dir: _book/ |