Merge pull request #21 from Jerry-FaGe/main #280
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: Generate application | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- '**.py' | |
push: | |
branches: | |
- main | |
paths: | |
- '**.py' | |
tags: | |
- "v*.*.*" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'false' | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.4' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt pyinstaller | |
- name: Generate program | |
run: | | |
pyinstaller -D --distpath .\dist\ -i .\assets\logo\Terminal.ico --contents-directory libraries --exclude-module PyQt5 --uac-admin -n "March7th Assistant" main.py -y | |
pyinstaller -D --distpath .\dist\ -i .\assets\logo\March7th.ico --contents-directory libraries --exclude-module cv2 --exclude-module numpy --uac-admin -n "March7th Launcher" app.py -y -w | |
pyinstaller -F --distpath .\dist\March7thAssistant\ -i .\assets\logo\Update.ico -n "Update" update.py -y | |
- name: Move assets to dist directory | |
run: | | |
xcopy /E /Y ".\dist\March7th Assistant\*" ".\dist\March7thAssistant\" | |
xcopy /E /Y ".\dist\March7th Launcher\*" ".\dist\March7thAssistant\" | |
xcopy /E /I /Y .\assets\ .\dist\March7thAssistant\assets\ | |
xcopy /Y .\README.md .\dist\March7thAssistant\ | |
- name: Upload artifact | |
if: startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: March7thAssistant | |
path: .\dist\March7thAssistant\ | |
- name: Create zip archive | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
ren .\dist\March7thAssistant March7thAssistant_${{ github.ref_name }} | |
powershell Compress-Archive -Path .\dist\March7thAssistant_${{ github.ref_name }}\ -DestinationPath .\dist\March7thAssistant_${{ github.ref_name }}.zip -Force | |
- name: Move 3rdparty to dist directory | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
python build.py github-actions | |
xcopy .\3rdparty\ .\dist\March7thAssistant_${{ github.ref_name }}\3rdparty\ /E /I /Y | |
powershell Copy-Item -Path .\assets\config\config.example.yaml -Destination .\dist\March7thAssistant_${{ github.ref_name }}\config.yaml -Force | |
- name: Create full zip archive | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
powershell Compress-Archive -Path .\dist\March7thAssistant_${{ github.ref_name }}\ -DestinationPath .\dist\March7thAssistant_${{ github.ref_name }}_full.zip -Force | |
- name: Create release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: March7thAssistant ${{ github.ref_name }} | |
files: | | |
./dist/March7thAssistant_${{ github.ref_name }}_full.zip | |
./dist/March7thAssistant_${{ github.ref_name }}.zip | |
prerelease: true | |