Skip to content

Commit 5b6c543

Browse files
committed
Automation script to build the project
1 parent 3e01769 commit 5b6c543

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/workflows/static.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
uses: actions/checkout@v4
3434
- name: Setup Pages
3535
uses: actions/configure-pages@v5
36+
- name: Build index-final.html
37+
run: |
38+
python build.py
3639
- name: Upload artifact
3740
uses: actions/upload-pages-artifact@v3
3841
with:

build.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# build.py
2+
html = open('index.html').read()
3+
css = open('style.css').read()
4+
js = open('app.js').read()
5+
6+
# Zakładam, że index.html ma <head>...</head> i </body>
7+
# Dodaj CSS do <head>
8+
html = html.replace(
9+
'</head>',
10+
f'<style>\n{css}\n</style>\n</head>'
11+
)
12+
# Dodaj JS na końcu przed </body>
13+
html = html.replace('<script src="app.js"></script>','');
14+
html = html.replace(
15+
'</body>',
16+
f'<script>\n{js}\n</script>\n</body>'
17+
)
18+
19+
with open('index-final.html', 'w') as f:
20+
f.write(html)

0 commit comments

Comments
 (0)