fix: workflow fixes
This commit is contained in:
parent
5917713b0d
commit
fbe0781229
2 changed files with 32 additions and 4 deletions
|
@ -41,15 +41,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
cache: yarn
|
cache: pnpm
|
||||||
cache-dependency-path: '**/yarn.lock'
|
cache-dependency-path: '**/pnpm-lock.yaml'
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/pip
|
~/.cache/pip
|
||||||
~/node_modules
|
~/node_modules
|
||||||
~/.cache/ms-playwright
|
~/.cache/ms-playwright
|
||||||
key: ${{ runner.os }}-pio-playwright-${{ hashFiles('**/yarn.lock') }}
|
key: ${{ runner.os }}-pio-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
- name: Get current date
|
- name: Get current date
|
||||||
id: dateAndTime
|
id: dateAndTime
|
||||||
run: echo "dateAndTime=$(date +'%Y-%m-%d-%H:%M')" >> $GITHUB_OUTPUT
|
run: echo "dateAndTime=$(date +'%Y-%m-%d-%H:%M')" >> $GITHUB_OUTPUT
|
||||||
|
@ -71,7 +71,7 @@ jobs:
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: npx playwright test
|
run: npx playwright test
|
||||||
- name: Build WebUI
|
- name: Build WebUI
|
||||||
run: yarn build
|
run: pnpm build
|
||||||
|
|
||||||
# The following steps only run on push to main
|
# The following steps only run on push to main
|
||||||
- name: Get current block
|
- name: Get current block
|
||||||
|
|
28
gzip_build.py
Normal file
28
gzip_build.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import os
|
||||||
|
import gzip
|
||||||
|
from shutil import copyfileobj
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def gzip_file(input_file, output_file):
|
||||||
|
with open(input_file, 'rb') as f_in:
|
||||||
|
with gzip.open(output_file, 'wb') as f_out:
|
||||||
|
copyfileobj(f_in, f_out)
|
||||||
|
|
||||||
|
def process_directory(input_dir, output_dir):
|
||||||
|
for root, dirs, files in os.walk(input_dir):
|
||||||
|
relative_path = os.path.relpath(root, input_dir)
|
||||||
|
output_root = os.path.join(output_dir, relative_path)
|
||||||
|
|
||||||
|
Path(output_root).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
for file in files:
|
||||||
|
# if file.endswith(('.html', '.css', '.js')):
|
||||||
|
input_file_path = os.path.join(root, file)
|
||||||
|
output_file_path = os.path.join(output_root, file + '.gz')
|
||||||
|
gzip_file(input_file_path, output_file_path)
|
||||||
|
print(f'Compressed: {input_file_path} -> {output_file_path}')
|
||||||
|
|
||||||
|
input_directory = 'dist'
|
||||||
|
output_directory = 'build_gz'
|
||||||
|
|
||||||
|
process_directory(input_directory, output_directory)
|
Loading…
Add table
Add a link
Reference in a new issue