Skip to content

Commit

Permalink
Merge pull request #3 from yusufk/development
Browse files Browse the repository at this point in the history
Added a workflow for content updates
  • Loading branch information
yusufk authored Jan 1, 2025
2 parents 208a963 + f1d99cb commit 7d4edd6
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/articles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Content

on:
push:
paths:
- 'public/data/**'
branches:
- content

jobs:
update-content:
runs-on: ubuntu-latest
steps:
- name: Checkout content branch
uses: actions/checkout@v2
with:
ref: content

- name: Generate indexes
run: |
cd public/data
for dir in */; do
if [ -d "$dir" ]; then
cd "$dir"
ls *.md 2>/dev/null | jq -R -s -c 'split("\n")[:-1]' > index.json
cd ..
fi
done
- name: Checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages

- name: Copy updated files
run: |
mkdir -p gh-pages/data
cp -r public/data/* gh-pages/data/
cd gh-pages
git config user.name github-actions
git config user.email [email protected]
git add data/
git commit -m "Update content from content branch" || echo "No changes to commit"
git push origin gh-pages

0 comments on commit 7d4edd6

Please sign in to comment.