Skip to content

Commit fb3c1a1

Browse files
authored
Add GitHub Actions workflow for Pages deployment
1 parent efec231 commit fb3c1a1

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/pages.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Generate Index & Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
paths:
9+
- 'skills/**/*.md'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
generate-and-deploy:
23+
runs-on: ubuntu-latest
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.11'
38+
39+
- name: Generate skills/index.json from SKILL.md metadata
40+
run: |
41+
echo "Scanning skills..."
42+
python3 scripts/generate-index.py
43+
44+
- name: Commit updated index.json (if changed)
45+
if: github.event_name != 'pull_request'
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git add skills/index.json
50+
git diff --staged --quiet || git commit -m "chore(auto): regenerate skills/index.json [skip ci]"
51+
git push
52+
53+
- name: Setup Pages
54+
if: github.event_name != 'pull_request'
55+
uses: actions/configure-pages@v5
56+
57+
- name: Upload Pages artifact
58+
if: github.event_name != 'pull_request'
59+
uses: actions/upload-pages-artifact@v3
60+
with:
61+
path: 'docs'
62+
63+
- name: Deploy to GitHub Pages
64+
if: github.event_name != 'pull_request'
65+
id: deployment
66+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)