-
Notifications
You must be signed in to change notification settings - Fork 0
auto update edge-tts #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
56e44f8
82db2b0
579683d
fad6d1a
a12de82
5d79afe
0f3af89
d5d90f6
cbf5fcd
5a5d1d5
207ba9b
76b9912
366b640
ebc7bb7
be9a086
3fc9146
914b789
938886f
7737a2f
3ea0d45
ee4de2a
3ae0527
25dc303
730dc88
bb266bd
7d70a13
d1f450d
5436727
d8c850e
1405787
1ad53b1
3956aed
a0b1f82
a2d0cea
6adf5b1
57df8ef
6bbabff
7672520
d56e12e
5aca8cf
f0cb455
dd0ffab
4f534c8
9095db5
979acca
008f0e0
c09bdcc
1cb53f6
ee60426
56967e2
cfcf2dd
1aa6813
5844084
4a6a8e5
693bfbc
326928e
a80e583
69800d3
365ef8e
61d9dcf
046c52f
7b33d13
638fb4e
59a7722
4a09f0b
99b9642
15efb3c
6ca3832
08355e7
0d7bb86
484caaf
a45dcfc
478e8ea
6ad992d
2fcaa47
4e39aa1
01b85b8
7a1ee84
8589ceb
0f9441b
ca487ed
a7b0ddf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,10 +116,10 @@ jobs: | |
| Write-Host "Executable size: $([math]::Round($size, 2)) MB" | ||
| shell: powershell | ||
|
|
||
| - name: Install WiX Toolset v4 | ||
| - name: Install WiX Toolset v5 | ||
| run: | | ||
| Write-Host "Installing WiX Toolset v4..." | ||
| dotnet tool install --global wix | ||
| Write-Host "Installing WiX Toolset v5..." | ||
| dotnet tool install --global wix --version 5.0.1 | ||
|
|
||
| # Ensure WiX is in PATH | ||
| $env:PATH = "$env:USERPROFILE\.dotnet\tools;$env:PATH" | ||
|
|
@@ -128,10 +128,9 @@ jobs: | |
| wix --version | ||
|
|
||
| Write-Host "Installing WiX UI extension globally..." | ||
| wix extension add --global WixToolset.UI.wixext | ||
| wix extension add --global WixToolset.UI.wixext/5.0.1 | ||
|
|
||
| Write-Host "Verifying UI extension..." | ||
| wix extension list | ||
| wix extension list --global | ||
|
|
||
| Write-Host "WiX installation complete" | ||
|
|
@@ -145,7 +144,16 @@ jobs: | |
| shell: powershell | ||
|
|
||
| - name: Build MSI Installer | ||
| run: python deployment/build_msi.py | ||
| run: | | ||
| # Ensure WiX is in PATH | ||
| $env:PATH = "$env:USERPROFILE\.dotnet\tools;$env:PATH" | ||
|
|
||
| # Verify WiX is accessible | ||
| wix --version | ||
|
|
||
| # Build MSI | ||
| python deployment/build_msi.py | ||
| shell: powershell | ||
| env: | ||
| VITE_APP_VERSION: ${{ steps.get_version.outputs.app_version }} | ||
|
|
||
|
|
@@ -256,7 +264,7 @@ jobs: | |
| create-release: | ||
| name: Create GitHub Release | ||
| runs-on: ubuntu-latest | ||
| needs: [build, linux-build, docker-build] | ||
| needs: [build, linux-build] | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
|
||
| steps: | ||
|
|
@@ -286,14 +294,6 @@ jobs: | |
| name: linux-build | ||
| path: ./linux-build | ||
|
|
||
| - name: Download Docker artifacts | ||
| if: needs.docker-build.result == 'success' | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: docker-release-files | ||
| path: ./docker-release | ||
| continue-on-error: true | ||
|
|
||
| - name: Get MSI filename | ||
| id: msi_info | ||
| run: | | ||
|
|
@@ -308,17 +308,6 @@ jobs: | |
| echo "MSI file not found, using default name" | ||
| fi | ||
|
|
||
| - name: Check Docker build status | ||
| id: docker_status | ||
| run: | | ||
| if [ "${{ needs.docker-build.result }}" == "success" ]; then | ||
| echo "docker_success=true" >> $GITHUB_OUTPUT | ||
| echo "Docker build succeeded" | ||
| else | ||
| echo "docker_success=false" >> $GITHUB_OUTPUT | ||
| echo "Docker build failed or was skipped - release will not include Docker files" | ||
| fi | ||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
|
|
@@ -680,19 +669,20 @@ jobs: | |
| type=raw,value=${{ steps.docker_version.outputs.docker_tag }} | ||
| type=raw,value=latest,enable=${{ steps.docker_version.outputs.is_release == 'true' }} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./docker/Dockerfile | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| build-args: | | ||
| APP_VERSION=${{ steps.docker_version.outputs.app_version }} | ||
| # Commented out to speed up CI - Docker build takes too long | ||
| # - name: Build and push Docker image | ||
| # uses: docker/build-push-action@v5 | ||
| # with: | ||
| # context: . | ||
| # file: ./docker/Dockerfile | ||
| # push: true | ||
| # tags: ${{ steps.meta.outputs.tags }} | ||
| # labels: ${{ steps.meta.outputs.labels }} | ||
| # platforms: linux/amd64,linux/arm64 | ||
| # cache-from: type=gha | ||
| # cache-to: type=gha,mode=max | ||
| # build-args: | | ||
| # APP_VERSION=${{ steps.docker_version.outputs.app_version }} | ||
|
Comment on lines
+672
to
+685
|
||
|
|
||
| - name: Generate docker-compose.yml for release | ||
| if: steps.docker_version.outputs.is_release == 'true' | ||
|
|
@@ -979,7 +969,7 @@ jobs: | |
| build-status-check: | ||
| name: Build Status Check | ||
| runs-on: ubuntu-latest | ||
| needs: [build, linux-build, docker-build] | ||
| needs: [build, linux-build] | ||
| if: always() | ||
|
|
||
| steps: | ||
|
|
@@ -995,9 +985,4 @@ jobs: | |
| echo "Cannot merge to main until build succeeds" | ||
| exit 1 | ||
| fi | ||
| if [ "${{ needs.docker-build.result }}" == "success" ]; then | ||
| echo "[PASS] Docker build succeeded" | ||
| elif [ "${{ needs.docker-build.result }}" == "failure" ]; then | ||
| echo "[WARN] Docker build failed - continuing anyway (Docker build is optional)" | ||
| fi | ||
| echo "[PASS] Required builds succeeded - safe to merge" | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import uuid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import subprocess |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _edge_tts_update_attempted guard is a shared global without synchronization. With concurrent synth requests, multiple tasks can still race into try_update_edge_tts() and run upgrades simultaneously. Consider guarding with an asyncio.Lock (or similar) to ensure only one update attempt runs at a time.
| async def try_update_edge_tts(): | |
| """Attempt to update edge-tts package when API compatibility issues occur""" | |
| global _edge_tts_update_attempted | |
| if _edge_tts_update_attempted: | |
| logger.info("edge-tts update already attempted this session, skipping") | |
| return False | |
| _edge_tts_update_attempted = True | |
| logger.info("Attempting to update edge-tts package to fix API compatibility...") | |
| _edge_tts_update_lock = asyncio.Lock() | |
| async def try_update_edge_tts(): | |
| """Attempt to update edge-tts package when API compatibility issues occur""" | |
| global _edge_tts_update_attempted | |
| async with _edge_tts_update_lock: | |
| if _edge_tts_update_attempted: | |
| logger.info("edge-tts update already attempted this session, skipping") | |
| return False | |
| _edge_tts_update_attempted = True | |
| logger.info("Attempting to update edge-tts package to fix API compatibility...") | |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a runtime pip install --upgrade edge-tts inside the server process. That can break reproducible deployments (conflicts with the pinned edge-tts==... in requirements), fail in read-only/container environments, and expands the attack surface by fetching code at runtime. Consider removing the auto-upgrade and instead surface a clear error/instruction (or gate it behind an explicit admin setting/env var and pin to an expected version).
| # Track edge-tts update attempts to avoid repeated updates | |
| _edge_tts_update_attempted = False | |
| async def try_update_edge_tts(): | |
| """Attempt to update edge-tts package when API compatibility issues occur""" | |
| global _edge_tts_update_attempted | |
| if _edge_tts_update_attempted: | |
| logger.info("edge-tts update already attempted this session, skipping") | |
| return False | |
| _edge_tts_update_attempted = True | |
| logger.info("Attempting to update edge-tts package to fix API compatibility...") | |
| try: | |
| # Run pip upgrade in subprocess | |
| python_exe = sys.executable | |
| result = await asyncio.create_subprocess_exec( | |
| python_exe, "-m", "pip", "install", "--upgrade", "edge-tts", | |
| stdout=asyncio.subprocess.PIPE, | |
| stderr=asyncio.subprocess.PIPE | |
| ) | |
| stdout, stderr = await result.communicate() | |
| if result.returncode == 0: | |
| logger.info(f"edge-tts successfully updated: {stdout.decode()}") | |
| # Reload the edge_tts module | |
| try: | |
| import importlib | |
| global edge_tts | |
| if edge_tts: | |
| importlib.reload(edge_tts) | |
| logger.info("edge-tts module reloaded successfully") | |
| else: | |
| import edge_tts as new_edge_tts | |
| edge_tts = new_edge_tts | |
| logger.info("edge-tts module imported successfully") | |
| return True | |
| except Exception as e: | |
| logger.warning(f"edge-tts updated but module reload failed: {e}") | |
| logger.info("Restart the application to use the updated edge-tts") | |
| return False | |
| else: | |
| logger.error(f"edge-tts update failed: {stderr.decode()}") | |
| return False | |
| except Exception as e: | |
| logger.error(f"Failed to update edge-tts: {e}") | |
| return False | |
| # Track edge-tts update attempts to avoid repeated update instructions | |
| _edge_tts_update_attempted = False | |
| async def try_update_edge_tts(): | |
| """Log a one-time instruction to update edge-tts outside the running process.""" | |
| global _edge_tts_update_attempted | |
| if _edge_tts_update_attempted: | |
| logger.info("edge-tts update already flagged this session, skipping") | |
| return False | |
| _edge_tts_update_attempted = True | |
| logger.error( | |
| "edge-tts appears incompatible, but automatic runtime upgrades are disabled. " | |
| "Please update the pinned 'edge-tts' dependency through your normal build/deploy " | |
| "process and restart the application." | |
| ) | |
| return False |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New 403-detection + auto-update retry logic isn’t covered by existing unit tests. Add a unit test that mocks edge_tts.Communicate.save to raise the 403 error once, asserts try_update_edge_tts() is invoked at most once per session, and verifies synthesis is retried (or that a clear error is surfaced when update fails).
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title indicates an edge-tts update, but this workflow change also upgrades WiX to v5 and changes release/build dependencies (including de-emphasizing Docker). If these are intentional, consider splitting them into a separate PR or updating the PR title/description so reviewers can assess CI/release changes explicitly.