github actions #18
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: Build Windows Executable | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [ created ] | |
jobs: | |
build: | |
name: Build exe with PyInstaller | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout code | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' # Use the version of Python you need | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyinstaller # Add other dependencies if needed | |
pip install -r requirements.txt | |
- name: Build Executable | |
run: | | |
echo ${{ github.sha }} > Release.txt | |
pyinstaller main.spec | |
mv dist baijing_autohelper | |
7z a -tzip -r "baijing_autohelper.zip" "baijing_autohelper" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app | |
path: baijing_autohelper.zip | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: upload-win | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: baijing_autohelper.zip | |
asset_name: baijing_autohelper.zip | |
asset_content_type: application/zip |