Skip to content

Commit 04ad837

Browse files
authored
Initial commit
0 parents  commit 04ad837

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6046
-0
lines changed

.claude/CLAUDE.md

Lines changed: 405 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/jekyll.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and Deploy Academic Website
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Ruby
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: '3.2'
30+
bundler-cache: true
31+
cache-version: 0
32+
working-directory: ./
33+
34+
- name: Setup Pages
35+
id: pages
36+
uses: actions/configure-pages@v4
37+
38+
- name: Build with Jekyll
39+
working-directory: ./
40+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
41+
env:
42+
JEKYLL_ENV: production
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: ./_site/
48+
49+
deploy:
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
runs-on: ubuntu-latest
54+
needs: build
55+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
56+
steps:
57+
- name: Deploy to GitHub Pages
58+
id: deployment
59+
uses: actions/deploy-pages@v4
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
name: Check for Template Updates
2+
3+
# This workflow checks for updates from the template repository
4+
# and creates a PR when updates are available
5+
#
6+
# To enable: Uncomment the schedule trigger below
7+
# To disable: Keep the schedule commented out or delete this file
8+
9+
on:
10+
# Uncomment to enable weekly checks:
11+
# schedule:
12+
# - cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC
13+
14+
# Manual trigger is always available
15+
workflow_dispatch:
16+
inputs:
17+
force:
18+
description: 'Force update even if no changes'
19+
required: false
20+
default: 'false'
21+
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
26+
jobs:
27+
check-update:
28+
runs-on: ubuntu-latest
29+
outputs:
30+
update_available: ${{ steps.check.outputs.update_available }}
31+
current_version: ${{ steps.check.outputs.current_version }}
32+
latest_version: ${{ steps.check.outputs.latest_version }}
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Check for updates
41+
id: check
42+
run: |
43+
chmod +x update-design.sh
44+
if [ "${{ github.event.inputs.force }}" = "true" ]; then
45+
./update-design.sh --check-only --non-interactive --force || true
46+
else
47+
./update-design.sh --check-only --non-interactive || true
48+
fi
49+
50+
apply-update:
51+
needs: check-update
52+
if: needs.check-update.outputs.update_available == 'true' || github.event.inputs.force == 'true'
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
60+
61+
- name: Configure Git
62+
run: |
63+
git config user.name "github-actions[bot]"
64+
git config user.email "github-actions[bot]@users.noreply.github.com"
65+
66+
- name: Create update branch
67+
run: |
68+
BRANCH_NAME="template-update-$(date +%Y%m%d-%H%M%S)"
69+
git checkout -b "$BRANCH_NAME"
70+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
71+
72+
- name: Download latest update script
73+
run: |
74+
echo "📥 Downloading latest update script from template..."
75+
curl -f -L -o update-design.sh.new https://raw.githubusercontent.com/mechanicpanic/academic-website/master/update-design.sh
76+
mv update-design.sh.new update-design.sh
77+
chmod +x update-design.sh
78+
79+
- name: Run update script
80+
id: update
81+
run: |
82+
if [ "${{ github.event.inputs.force }}" = "true" ]; then
83+
./update-design.sh --non-interactive --force
84+
else
85+
./update-design.sh --non-interactive
86+
fi
87+
88+
- name: Commit changes
89+
id: commit
90+
run: |
91+
git add -A
92+
if git diff --staged --quiet; then
93+
echo "No changes to commit"
94+
echo "has_changes=false" >> $GITHUB_OUTPUT
95+
else
96+
CURRENT="${{ needs.check-update.outputs.current_version }}"
97+
LATEST="${{ needs.check-update.outputs.latest_version }}"
98+
git commit -m "Update design from template v$CURRENT → v$LATEST" \
99+
-m "Automated update from mechanicpanic/academic-website" \
100+
-m "" \
101+
-m "🤖 Generated by GitHub Actions"
102+
git push origin "$BRANCH_NAME"
103+
echo "has_changes=true" >> $GITHUB_OUTPUT
104+
fi
105+
106+
- name: Check for conflicts
107+
id: conflicts
108+
if: steps.commit.outputs.has_changes == 'true'
109+
run: |
110+
# Check if user has modified design files
111+
MODIFIED=""
112+
for file in _layouts _sass assets/css/main.scss _plugins; do
113+
if [ -e "$file" ]; then
114+
if git log --all --oneline -- "$file" 2>/dev/null | \
115+
grep -v "Update design" | \
116+
grep -v "template update" | \
117+
grep -v "github-actions" > /dev/null; then
118+
MODIFIED="$MODIFIED $file"
119+
fi
120+
fi
121+
done
122+
123+
if [ -n "$MODIFIED" ]; then
124+
echo "has_conflicts=true" >> $GITHUB_OUTPUT
125+
echo "modified_files=$MODIFIED" >> $GITHUB_OUTPUT
126+
else
127+
echo "has_conflicts=false" >> $GITHUB_OUTPUT
128+
fi
129+
130+
- name: Get changelog
131+
id: changelog
132+
if: steps.commit.outputs.has_changes == 'true'
133+
run: |
134+
LATEST="${{ needs.check-update.outputs.latest_version }}"
135+
CHANGELOG=$(curl -s "https://raw.githubusercontent.com/mechanicpanic/academic-website/master/CHANGELOG.md" | \
136+
sed -n "/## \[$LATEST\]/,/## \[/p" | head -n -1)
137+
138+
# Save to file for PR body
139+
echo "$CHANGELOG" > /tmp/changelog.md
140+
141+
- name: Create Pull Request
142+
if: steps.commit.outputs.has_changes == 'true'
143+
uses: peter-evans/create-pull-request@v5
144+
id: pr
145+
with:
146+
token: ${{ secrets.GITHUB_TOKEN }}
147+
branch: ${{ env.BRANCH_NAME }}
148+
title: "🎨 Template Update: v${{ needs.check-update.outputs.current_version }} → v${{ needs.check-update.outputs.latest_version }}"
149+
body: |
150+
## 🎨 Template Design Update Available
151+
152+
A new version of the academic website template is available!
153+
154+
**Current Version:** `${{ needs.check-update.outputs.current_version }}`
155+
**New Version:** `${{ needs.check-update.outputs.latest_version }}`
156+
157+
### 📋 What's New
158+
159+
${{ steps.changelog.outputs.content }}
160+
161+
### 🔍 Conflict Check
162+
163+
**Safe to auto-merge:** ${{ steps.conflicts.outputs.has_conflicts == 'false' && '✅ Yes' || '⚠️ No - Review needed' }}
164+
165+
${{ steps.conflicts.outputs.has_conflicts == 'true' && format('**Modified files:** {0}', steps.conflicts.outputs.modified_files) || '' }}
166+
167+
### 🚀 What to Do
168+
169+
${{ steps.conflicts.outputs.has_conflicts == 'false' && '
170+
This PR can be safely merged! No conflicts detected with your customizations.
171+
172+
**To merge:**
173+
1. Review the changes below
174+
2. Click "Merge pull request"
175+
3. Your site will be updated automatically
176+
' || '
177+
**⚠️ Manual review recommended**
178+
179+
You have customized design files that may conflict with this update:
180+
' }}
181+
${{ steps.conflicts.outputs.modified_files }}
182+
${{ steps.conflicts.outputs.has_conflicts == 'true' && '
183+
184+
**Recommended steps:**
185+
1. Review the changes carefully
186+
2. Test locally: `git fetch && git checkout ' || '' }}${{ env.BRANCH_NAME }}${{ steps.conflicts.outputs.has_conflicts == 'true' && ' && bundle exec jekyll serve`
187+
3. Merge conflicts if needed
188+
4. Merge when ready
189+
' || '' }}
190+
191+
### 📚 Resources
192+
193+
- [Template Repository](https://github.com/mechanicpanic/academic-website)
194+
- [Full Changelog](https://github.com/mechanicpanic/academic-website/blob/master/CHANGELOG.md)
195+
- [Update Script Documentation](https://github.com/mechanicpanic/academic-website#updating-the-template)
196+
197+
---
198+
199+
*This PR was created automatically by the template-update workflow.*
200+
*Your content in `vault/` and `_config.yml` has been preserved.*
201+
202+
🤖 Generated by [GitHub Actions](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
203+
labels: |
204+
template-update
205+
automated
206+
draft: false
207+
208+
- name: Enable auto-merge if safe
209+
if: steps.commit.outputs.has_changes == 'true' && steps.conflicts.outputs.has_conflicts == 'false'
210+
env:
211+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
212+
run: |
213+
# Enable auto-merge with squash
214+
gh pr merge --auto --squash --delete-branch \
215+
--subject "Update design to v${{ needs.check-update.outputs.latest_version }}" \
216+
${{ steps.pr.outputs.pull-request-number }}
217+
218+
echo "✅ Auto-merge enabled for PR #${{ steps.pr.outputs.pull-request-number }}"
219+
echo "The PR will merge automatically once checks pass"
220+
221+
- name: Comment on PR
222+
if: steps.commit.outputs.has_changes == 'true'
223+
env:
224+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225+
run: |
226+
if [ "${{ steps.conflicts.outputs.has_conflicts }}" = "false" ]; then
227+
COMMENT="✅ **Auto-merge enabled!**
228+
229+
This PR will merge automatically because:
230+
- No conflicts detected with your customizations
231+
- All checks passing
232+
- Only template design files are updated
233+
234+
Your content and configuration remain untouched."
235+
else
236+
COMMENT="⚠️ **Manual review needed**
237+
238+
This PR requires your attention because you've customized:
239+
${{ steps.conflicts.outputs.modified_files }}
240+
241+
Please review the changes and merge when ready."
242+
fi
243+
244+
gh pr comment ${{ steps.pr.outputs.pull-request-number }} --body "$COMMENT"
245+
246+
- name: Summary
247+
if: steps.commit.outputs.has_changes == 'true'
248+
run: |
249+
echo "## 🎨 Template Update Summary" >> $GITHUB_STEP_SUMMARY
250+
echo "" >> $GITHUB_STEP_SUMMARY
251+
echo "**PR Created:** #${{ steps.pr.outputs.pull-request-number }}" >> $GITHUB_STEP_SUMMARY
252+
echo "**Version:** ${{ needs.check-update.outputs.current_version }} → ${{ needs.check-update.outputs.latest_version }}" >> $GITHUB_STEP_SUMMARY
253+
echo "**Auto-merge:** ${{ steps.conflicts.outputs.has_conflicts == 'false' && 'Enabled ✅' || 'Disabled ⚠️' }}" >> $GITHUB_STEP_SUMMARY
254+
echo "" >> $GITHUB_STEP_SUMMARY
255+
echo "[View Pull Request](${{ steps.pr.outputs.pull-request-url }})" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Jekyll build files
2+
_site/
3+
.sass-cache/
4+
.jekyll-cache/
5+
.jekyll-metadata
6+
7+
# Ruby/Bundle files
8+
vendor/
9+
.bundle/
10+
Gemfile.lock
11+
12+
# OS generated files
13+
.DS_Store
14+
.DS_Store?
15+
._*
16+
.Spotlight-V100
17+
.Trashes
18+
ehthumbs.db
19+
Thumbs.db
20+
21+
# Editor files
22+
.vscode/
23+
.idea/
24+
.claude/
25+
*.swp
26+
*.swo
27+
*~
28+
29+
# Logs
30+
*.log
31+
32+
# Temporary files
33+
*.tmp
34+
*.temp
35+
36+
# Node modules (if using any)
37+
node_modules/
38+
39+
# Environment variables
40+
.env
41+
.env.local
42+
.env.development.local
43+
.env.test.local
44+
.env.production.local
45+
46+
# Backup files
47+
*.bak
48+
*.backup
49+
50+
# Academic-specific ignores
51+
# Uncomment if you don't want to track these
52+
# assets/pdfs/
53+
# assets/images/personal/

0 commit comments

Comments
 (0)