Update links.json #24
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: Sync | |
on: | |
# Run if push to `master` branch | |
push: | |
branches: | |
- master | |
jobs: | |
sync: | |
# Use latest Ubuntu Linux | |
runs-on: ubuntu-latest | |
steps: | |
# Use Deno | |
- name: Use Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
# Config Git | |
- name: Enable Git colorful output | |
run: git config --global color.ui true | |
# Get src from kuohuanhuan/blog | |
- name: Get source file (blog) | |
uses: actions/checkout@v3 | |
with: | |
repository: 'kuohuanhuan/blog' | |
path: 'current' | |
token: ${{ secrets.GH_PAT }} # Personal Access Token | |
# Get src from kuohuanhuan/nekohuan.cyou | |
- name: Get source file (site) | |
uses: actions/checkout@v3 | |
with: | |
repository: 'kuohuanhuan/nekohuan.cyou' | |
path: 'target' | |
token: ${{ secrets.GH_PAT }} # Personal Access Token | |
# Edit posts list file | |
- name: Edit list.json | |
run: | | |
cd current | |
deno run --allow-read --allow-write scripts/posts.ts | |
cd .. | |
# Update posts list file | |
- name: Update list.json | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'list.json' | |
committer_name: GitHub Actions | |
committer_email: 41898282+github-actions[bot]@users.noreply.github.com | |
cwd: './current' | |
message: '[skip ci] chore: update posts list (pushed by GitHub Actions)' | |
# Edit RSS Feed file | |
- name: Edit public/atom.xml | |
run: | | |
cd target | |
deno run --allow-read --allow-write ../current/scripts/rss.ts | |
cd .. | |
# Edit commit hash file | |
- name: Edit config/source.ts | |
run: | | |
cd current | |
COMMIT_HASH=$(git rev-parse HEAD) | |
cd ../target | |
rm config/source.ts -f | |
echo "export const COMMIT_HASH = '$COMMIT_HASH' // Generated by GitHub Actions, don't modify." >> config/source.ts | |
cd .. | |
# Sync files to nekohuan.cyou | |
- name: Sync files | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'public/atom.xml config/source.ts' | |
committer_name: GitHub Actions | |
committer_email: 41898282+github-actions[bot]@users.noreply.github.com | |
cwd: './target' | |
message: '[skip ci] chore: sync files (pushed by GitHub Actions)' | |
# Authored by KuoHuanHuan. |