-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 1.8 KB
/
gamstack.yml
File metadata and controls
65 lines (56 loc) · 1.8 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
name: gam-stack-worker
on:
push:
paths:
- 'input/*.md'
workflow_dispatch:
permissions:
contents: write
jobs:
convert-and-generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install markdown-to-html converter and Pandoc
run: |
npm install -g markdown-it-cli
sudo apt-get update
sudo apt-get install -y pandoc
- name: Convert Markdown to HTML
run: |
mkdir -p output
for file in input/*.md; do
output_file="output/$(basename "${file%.md}.html")"
markdown-it "$file" > "$output_file"
done
- name: Generate New Index.html
run: |
echo "<!DOCTYPE html>" > index.html
echo "<html>" >> index.html
echo "<head><title>GAMstack Website</title></head>" >> index.html
echo "<body>" >> index.html
echo "<h1>GAMstack Website</h1>" >> index.html
echo "<ul>" >> index.html
for file in output/*.html; do
filename=$(basename "$file")
echo "<li><a href='output/$filename'>$filename</a></li>" >> index.html
done
echo "</ul>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html
- name: Commit and Push Changes
run: |
if ls output/*.html 1> /dev/null 2>&1; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add index.html output/*.html
git commit -m "Convert Markdown to HTML and Generate Index [GitHub Actions]"
git push
else
echo "No HTML files to commit."
fi