-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (46 loc) · 1.93 KB
/
update-home-page.yaml
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
name: Update Homepage
on:
push:
branches:
- main
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate Homepage
run: |
echo "# SkunkWorks" > index.md
echo "## Projects" >> index.md
for file in projects/*.md; do
if [[ $file == "projects/_template.md" ]]; then
continue
fi
title=$(grep -m 1 '^title:' $file | cut -d '"' -f 2)
description=$(grep -m 1 '^description:' $file | cut -d '"' -f 2)
status=$(grep -m 1 '^status:' $file | cut -d '"' -f 2)
contributors=$(grep '^ - ' $file | cut -d '"' -f 2 | paste -sd ', ' -)
tech=$(grep -A 1 '^technology:' $file | tail -n +2 | grep -v '^---' | sed 's/ - //g' | paste -sd ', ' -)
screenshots=$(grep -A 1 '^screenshots:' $file | tail -n +2 | grep -v '^---' | sed 's/ - //g' | paste -sd ' ' -)
tags=$(grep -A 1 '^tags:' $file | tail -n +2 | grep -v '^---' | sed 's/ - //g' | paste -sd ', ' -)
echo "### [$title]($file)" >> index.md
echo "**Status:** $status" >> index.md
echo "**Description:** $description" >> index.md
echo "**Contributors:** $contributors" >> index.md
echo "**Technology:** $tech" >> index.md
echo "**Screenshots:**" >> index.md
for screenshot in $screenshots; do
echo "![$screenshot]($screenshot)" >> index.md
done
echo "**Tags:** $tags" >> index.md
echo "" >> index.md
echo "---" >> index.md
done
- name: Commit changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add index.md
git commit -m "Automatically update homepage with project details and tech stack"
git push