-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (76 loc) · 2.32 KB
/
generate-calendar.yml
File metadata and controls
92 lines (76 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Generate Calendar Files
on:
push:
branches:
- main
- master
paths:
- '**.md'
- 'mdcal.py'
- '.github/workflows/generate-calendar.yml'
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch: # Allow manual triggering
# Sets permissions for GitHub Pages deployment
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Generate calendar files
run: |
# Find all markdown files (excluding README and other common docs)
# Note: Removed -type f to support both regular files and symlinks
find . -name "*.md" \
-not -path "./node_modules/*" \
-not -path "./.git/*" \
-not -name "README.md" \
-not -name "LICENSE.md" \
-not -name "CONTRIBUTING.md" \
-exec sh -c 'echo "Processing: $1"; python3 mdcal.py "$1" || echo "Failed: $1"' sh {} \;
- name: Generate index page
run: python3 mdcal.py --generate-index
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "🤖 Auto-generate calendar files"
file_pattern: '*.html *.ics'
commit_user_name: GitHub Actions Bot
commit_user_email: [email protected]
commit_author: GitHub Actions Bot <[email protected]>
deploy:
needs: generate
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Pull latest changes
run: git pull origin ${{ github.ref_name }}
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4