Files
tg-ws-proxy-docker/.github/workflows/build.yml
2026-03-15 01:44:37 +03:00

127 lines
3.5 KiB
YAML

name: Build & Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version tag (e.g. v1.0.0)"
required: true
default: "v1.0.0"
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install pyinstaller
run: pip install pyinstaller
- name: Build EXE with PyInstaller
run: pyinstaller packaging/windows.spec --noconfirm
- name: Save UPX build copy
run: Copy-Item dist/TgWsProxy.exe dist/TgWsProxy-upx.exe -Force
- name: Build EXE without UPX
shell: pwsh
run: |
$specIn = "packaging/windows.spec"
$specOut = "packaging/windows.no-upx.spec"
$content = Get-Content $specIn -Raw
if ($content -notmatch "upx=True") {
throw "Expected 'upx=True' in $specIn, cannot generate no-UPX spec"
}
$content = $content -replace "upx=True", "upx=False"
Set-Content -Path $specOut -Value $content -Encoding UTF8
pyinstaller $specOut --noconfirm --clean
Remove-Item $specOut -Force
- name: Rename non-UPX artifact
run: Rename-Item -Path dist/TgWsProxy.exe -NewName TgWsProxy-no-upx.exe
- name: Restore default artifact name
run: Copy-Item dist/TgWsProxy-upx.exe dist/TgWsProxy.exe -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: TgWsProxy
path: |
dist/TgWsProxy.exe
dist/TgWsProxy-no-upx.exe
build-win7:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python 3.8 (last version supporting Win7)
uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "pip"
- name: Install dependencies (Win7-compatible)
run: pip install -r requirements-win7.txt
- name: Install pyinstaller
run: pip install "pyinstaller==5.13.2"
- name: Build EXE with PyInstaller (Win7)
run: pyinstaller packaging/windows.spec --noconfirm
- name: Rename artifact
run: mv dist/TgWsProxy.exe dist/TgWsProxy-win7.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: TgWsProxy-win7
path: dist/TgWsProxy-win7.exe
release:
needs: [build, build-win7]
runs-on: ubuntu-latest
steps:
- name: Download main build
uses: actions/download-artifact@v4
with:
name: TgWsProxy
path: dist
- name: Download Win7 build
uses: actions/download-artifact@v4
with:
name: TgWsProxy-win7
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
name: "TG WS Proxy ${{ github.event.inputs.version }}"
body: |
## TG WS Proxy ${{ github.event.inputs.version }}
files: |
dist/TgWsProxy.exe
dist/TgWsProxy-unstripped.exe
dist/TgWsProxy-win7.exe
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}