-
Notifications
You must be signed in to change notification settings - Fork 803
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
Showing
1 changed file
with
71 additions
and
22 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 |
---|---|---|
@@ -1,39 +1,88 @@ | ||
name: Run PyInstaller Executable | ||
name: Build PyInstaller Executables for Multiple Platforms | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 当推送到 main 分支时执行 | ||
- main # 当推送到 main 分支时触发 | ||
pull_request: | ||
branches: | ||
- main # 当创建 PR 到 main 分支时执行 | ||
- main # 当创建 PR 到 main 分支时触发 | ||
|
||
jobs: | ||
run-executable: | ||
runs-on: ubuntu-latest # 使用 Ubuntu 环境 | ||
build-linux: | ||
runs-on: ubuntu-latest # 在 Ubuntu 上编译 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 # 获取仓库代码 | ||
uses: actions/checkout@v3 # 获取代码 | ||
|
||
- name: Set up Python (optional) | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' # 如果你的脚本还需要 Python 环境 | ||
python-version: '3.9' | ||
|
||
- name: Make executable file executable (if on Linux) | ||
if: runner.os == 'Linux' | ||
run: chmod +x ./ss # 在 Linux 上需要给文件执行权限 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pyinstaller requests pyaes | ||
- name: Compile for Linux | ||
run: pyinstaller --onefile ss.py | ||
|
||
- name: Upload Linux Executable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ss-linux | ||
path: ./ss # 上传生成的可执行文件 | ||
|
||
build-macos: | ||
runs-on: macos-latest # 在 macOS 上编译 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 # 获取代码 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pyinstaller requests pyaes | ||
- name: Run the compiled executable | ||
- name: Compile for macOS | ||
run: pyinstaller --onefile ss.py | ||
|
||
- name: Upload macOS Executable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ss-macos | ||
path: ./ss # 上传生成的可执行文件 | ||
|
||
build-windows: | ||
runs-on: windows-latest # 在 Windows 上编译 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 # 获取代码 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
# 对于 Linux/macOS 环境 | ||
ls ./ | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
./ss # 运行已编译的可执行文件 | ||
fi | ||
# 对于 Windows 环境 | ||
if [ "$RUNNER_OS" == "Windows" ]; then | ||
./ss.exe # 运行已编译的可执行文件 | ||
fi | ||
python -m pip install --upgrade pip | ||
pip install pyinstaller requests pyaes | ||
- name: Compile for Windows | ||
run: pyinstaller --onefile ss.py | ||
|
||
- name: Upload Windows Executable | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ss-windows | ||
path: ./ss.exe # 上传生成的可执行文件 |