-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lilingfengdev
committed
Jun 10, 2024
1 parent
bc639f9
commit ab44a38
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
permissions: | ||
contents: write | ||
|
||
on: | ||
[push] | ||
|
||
jobs: | ||
build: | ||
name: Auto Release | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macos-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11" | ||
- name: Install Dependencies and Generate Bundle | ||
run: | | ||
python generate-bundle.py | ||
- name: Auto release | ||
uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: ${{ matrix.os }} | ||
prerelease: true | ||
files: | | ||
dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import shutil | ||
import urllib.request | ||
import zipfile | ||
import platform | ||
|
||
os.system("python3 -m pip install cn_bing_translator requests pyinstaller") | ||
if platform.system() == 'Windows': | ||
urllib.request.urlretrieve("https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip", | ||
"upx.zip") | ||
zip = zipfile.ZipFile("upx.zip") | ||
zip.extract("upx-4.2.4-win64/upx.exe", path=os.getcwd()) | ||
shutil.move("upx-4.2.4-win64/upx.exe", os.path.join(os.getcwd(), "upx.exe")) | ||
|
||
import PyInstaller.__main__ | ||
|
||
os.mkdir("dist") | ||
|
||
flag = ["-F", "main.py", "--optimize", "2"] | ||
if platform.system() != 'Windows': | ||
flag.append("--strip") | ||
PyInstaller.__main__.run(flag) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters