Skip to content

github actions

github actions #50

Workflow file for this run

name: Build Windows Executable
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
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
(Get-Content config.py) -replace 'version = "v0.0.1"', 'version = "${{ github.ref }}"' | Set-Content config.py
pyinstaller main.spec
mv dist/bundle ok-baijing
7z a -tzip -r "ok-baijing-${{ github.ref }}.zip" "ok-baijing"
rm -r dist
pyinstaller main_debug.spec
mv dist/bundle ok-baijing-debug
7z a -tzip -r "ok-baijing-debug-${{ github.ref }}.zip" "ok-baijing-debug"
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: upload-win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-baijing.7z
asset_name: ok-baijing.7z
asset_content_type: application/zip
- name: upload-win-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ok-baijing-debug.7z
asset_name: ok-baijing-debug.7z
asset_content_type: application/zip