Skip to content

Commit

Permalink
add: bundled HTML to release
Browse files Browse the repository at this point in the history
  • Loading branch information
luftaquila committed Oct 23, 2024
1 parent 26015bd commit 3c918a0
Show file tree
Hide file tree
Showing 7 changed files with 2,052 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: make
run: |
cd viewer/web
npm ci
npm ci --production
cd ../native
npm ci
npm run tauri build
Expand All @@ -48,7 +48,7 @@ jobs:
- name: make
run: |
cd viewer/web
npm ci
npm ci --production
cd ../native
npm ci
npm run tauri build
Expand All @@ -74,7 +74,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
cd viewer/web
npm ci
npm ci --production
cd ../native
npm ci
npm run tauri build
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
uses: ./.github/workflows/kicad.yml
build-native:
uses: ./.github/workflows/native.yml
build-html:
uses: ./.github/workflows/web-bundle.yml
deploy-web:
uses: ./.github/workflows/web.yml
release:
Expand All @@ -27,15 +29,17 @@ jobs:
mv build.fsk-energymeter-windows-x64/fsk-energymeter.exe fsk-energymeter-windows-x64-${{ github.ref_name }}.exe
mv build.fsk-energymeter-linux-x64/fsk-energymeter*.AppImage fsk-energymeter-linux-x64-${{ github.ref_name }}.AppImage
zip -r fsk-energymeter-pcb-${{ github.ref_name }}.zip fsk-energymeter-pcb
mv html/fsk-energymeter.html fsk-energymeter-${{ github.ref_name }}.html
- uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: |
fsk-energymeter-firmware-*.zip
fsk-energymeter-pcb-*.zip
fsk-energymeter-windows-x64-*
fsk-energymeter-macos-arm64-*
fsk-energymeter-linux-x64-*
fsk-energymeter-pcb-*.zip
fsk-energymeter-*.html
commit: ${{ github.sha }}
tag: ${{ github.ref_name }}
body: |
Expand All @@ -46,7 +50,8 @@ jobs:
### FSK-EEM Viewer
#### Web
https://luftaquila.github.io/fsk-energymeter/
* https://luftaquila.github.io/fsk-energymeter
* `fsk-energymeter-${{ github.ref_name }}.html`
#### Windows
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/web-bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build bundled HTML

on:
push:
paths:
- 'viewer/web/**'
workflow_call:
workflow_dispatch:

jobs:
build-html:
name: Build html
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: viewer/native/package-lock.json
- run: |
sudo apt-get update
cd viewer/web
npm ci
npx inliner index.html > fsk-energymeter.html
- uses: actions/upload-artifact@v4
with:
name: html
path: viewer/web/fsk-energymeter.html
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install Dependencies
run: |
cd viewer/web
npm ci
npm ci --production
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion viewer/web/lib/uplot_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function downloadImage(uplot, filename) {
let htmlContent = uplot.root.outerHTML;

//NOTE: Use correct index here to address uPlot stylesheet. Needs to be in a separate resource for this to work.
let uPlotCssRules = [...document.styleSheets].find(x => x.href && x.href.includes("uplot")).cssRules;
let uPlotCssRules = [...document.styleSheets].find(x => x.cssRules[0].selectorText && x.cssRules[0].selectorText.includes("uplot")).cssRules;
let cssContent = "";

for (let { cssText } of uPlotCssRules) {
Expand Down
Loading

0 comments on commit 3c918a0

Please sign in to comment.