|
| 1 | +name: Python Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + tags: |
| 8 | + - 'v*' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - '**' |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: windows-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up Python 3.10.9 |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: "3.10.9" |
| 28 | + cache: "pip" |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install -r requirements.txt |
| 34 | + pip install pyinstaller |
| 35 | +
|
| 36 | + - name: Build with PyInstaller |
| 37 | + run: | |
| 38 | + pyinstaller --onefile --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all apted main.py |
| 39 | +
|
| 40 | + - name: Prepare artifact |
| 41 | + shell: pwsh |
| 42 | + run: | |
| 43 | + copy ${env:RUNNER_TOOL_CACHE}\python\3.10.9\x64\lib\site-packages\paddle\libs\mklml.dll dist/ |
| 44 | + copy config.yaml dist/ |
| 45 | + copy -Recurse resource dist/resource |
| 46 | + copy -Recurse public dist/public |
| 47 | +
|
| 48 | + - name: Upload artifact |
| 49 | + uses: actions/upload-artifact@v4 |
| 50 | + with: |
| 51 | + name: umamusume-auto-trainer |
| 52 | + path: dist/ |
| 53 | + |
| 54 | + release: |
| 55 | + runs-on: windows-latest |
| 56 | + if: startsWith(github.ref, 'refs/tags/') |
| 57 | + needs: build |
| 58 | + permissions: |
| 59 | + contents: write |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Download build artifact |
| 63 | + uses: actions/download-artifact@v4 |
| 64 | + with: |
| 65 | + name: umamusume-auto-trainer |
| 66 | + |
| 67 | + - name: Package release assets |
| 68 | + shell: pwsh |
| 69 | + run: | |
| 70 | + $releaseName = "umamusume-auto-trainer-${{ github.ref_name }}-windows-x64" |
| 71 | + Compress-Archive -Path * -DestinationPath "${releaseName}.zip" |
| 72 | +
|
| 73 | + - name: Create GitHub Release |
| 74 | + uses: softprops/action-gh-release@v2 |
| 75 | + with: |
| 76 | + generate_release_notes: true |
| 77 | + files: "umamusume-auto-trainer-*-windows-x64.zip" |
0 commit comments