修改工作流异常问题 #3
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
name: Run PyInstaller Executable | |
on: | |
push: | |
branches: | |
- main # 当推送到 main 分支时执行 | |
pull_request: | |
branches: | |
- main # 当创建 PR 到 main 分支时执行 | |
jobs: | |
run-executable: | |
runs-on: ubuntu-latest # 使用 Ubuntu 环境 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 # 获取仓库代码 | |
- name: Set up Python (optional) | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' # 如果你的脚本还需要 Python 环境 | |
- name: Make executable file executable (if on Linux) | |
if: runner.os == 'Linux' | |
run: chmod +x ./ss # 在 Linux 上需要给文件执行权限 | |
- name: Run the compiled executable | |
run: | | |
# 对于 Linux/macOS 环境 | |
ls ./ | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
./ss # 运行已编译的可执行文件 | |
fi | |
# 对于 Windows 环境 | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
./ss.exe # 运行已编译的可执行文件 | |
fi |