diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 551079b..04bc916 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: run: make - name: Build page (Python) - run: ./build-pwa.py && ./build-pwa.py --jap + run: ./build-pwa.py --download && ./build-pwa.py --jap - name: Setup Pages uses: actions/configure-pages@v3 diff --git a/build-pwa.py b/build-pwa.py index 54020e6..6159d83 100755 --- a/build-pwa.py +++ b/build-pwa.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 from base64 import b64encode as b64 +import requests import sys title = 'Coco Battle Royale II' @@ -11,9 +12,16 @@ input = './bin/kokobatoru.nes' output = './html/jap.html' +if '--download' in sys.argv: + for file_name in ['nes.min.js']: + cdn = 'https://cdn.jsdelivr.net/gh/takahirox/nes-js@v0.0.1/build' + with requests.get(f'{cdn}/{file_name}', stream=True) as download: + file_name = file_name.replace(r'.min.js', '.js') + open(f'./html/{file_name}', "w").write(download.text) + rom = b64(open(input, "rb").read()).decode() html = open("./res/index.html", "r").read() html = html.replace(r'{{game}}', title).replace(r'{{rom}}', rom) - open(output, "w").write(html) + print(title)