Skip to content

Commit

Permalink
修改工作流异常问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yixiu001 committed Nov 11, 2024
1 parent 5cf481e commit 4b6776b
Showing 1 changed file with 71 additions and 22 deletions.
93 changes: 71 additions & 22 deletions .github/workflows/script.yaml
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 # 上传生成的可执行文件

0 comments on commit 4b6776b

Please sign in to comment.