Skip to content

Commit

Permalink
update: add pre deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Turmoil committed Oct 4, 2024
1 parent 7bee9db commit be8f9cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ concurrency:
jobs:
# Build job to minify the project
build:
runs-on: linux-latest
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install NodeJS
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: "20.x"

Expand All @@ -34,13 +34,15 @@ jobs:
npm install
- name: Add Secret Files
env:
NOTIFICATION: ${{ secrets.NOTIFICATION }}
STATISTICS: ${{ secrets.STATISTICS }}
SUPPORT: ${{ secrets.SUPPORT }}
run: |
echo ${{ secrets.NOTIFICATION }} > src/views/components/notification.html
echo ${{ secrets.STATISTICS }} > src/views/components/statistics.html
echo ${{ secrets.SUPPORT }} > src/views/components/support.html
python pre_deploy.py
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"

Expand All @@ -58,7 +60,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: linux-latest
runs-on: windows-latest
needs: build
steps:
- name: Deploy to GitHub Pages
Expand Down
23 changes: 23 additions & 0 deletions pre_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
This script is used to generate the private HTML files in
GitHub actions. The HTML files are stored in the environment.
"""

import os

notification = os.environ["NOTIFICATION"]
statistics = os.environ["STATISTICS"]
support = os.environ["SUPPORT"]

assert notification is not None
assert statistics is not None
assert support is not None

print("Generating HTML files...")
with open("src/views/components/notification.html", "w") as f:
f.write(notification)
with open("src/views/components/statistics.html", "w") as f:
f.write(statistics)
with open("src/views/components/support.html", "w") as f:
f.write(support)
print("HTML files generated.")

0 comments on commit be8f9cf

Please sign in to comment.