0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-04-24 16:35:23 +00:00
2025-04-16 11:51:02 +08:00

118 lines
3.7 KiB
YAML

name: Build Windows Executable
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
jobs:
build:
name: Build exe with launcher
runs-on: windows-latest
env:
PYTHONIOENCODING: 'UTF-8'
strategy:
matrix:
python-version: [ 3.12 ]
steps:
- name: Configure git
run: |
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
git config --global core.autocrlf false
git config --global core.eol lf
git config --global user.email "ok-oldking@users.noreply.github.com"
git config --global user.name "ok-oldking"
echo "action_state=yellow" >> $env:GITHUB_ENV
echo "${{ env.action_state }}"
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set UTF-8 encoding
run: |
set PYTHONIOENCODING=utf-8
set PYTHONLEGACYWINDOWSSTDIO=utf-8
echo PYTHONIOENCODING=utf-8 >> $GITHUB_ENV
- name: Get Changes between Tags
id: changes
uses: simbo/changes-between-tags-action@v1
with:
include-hashes: false
validate-tag: false
- name: Get tag name
id: tagName
uses: olegtarasov/get-tag@v2.1.3
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Copy ok-script lib
run: |
python -m ok.update.copy_ok_folder
- name: Rename .py files to .pyx
run: |
Get-ChildItem -Path .\src -Recurse -Filter *.py -Exclude '__init__.py' | ForEach-Object { Rename-Item $_.FullName -NewName ($_.FullName -replace '\.py$', '.pyx') }
- name: build cython
run: |
python setup.py build_ext --inplace
Get-ChildItem -Path .\src -Recurse -Filter *.pyx | ForEach-Object { Remove-Item $_.FullName }
Get-ChildItem -Path .\src -Recurse -Filter *.cpp | ForEach-Object { Remove-Item $_.FullName }
- name: Run tests
run: |
Get-ChildItem -Path ".\tests\*.py" | ForEach-Object {
Write-Host "Running tests in $($_.FullName)"
python -m unittest $_.FullName
}
- name: Build Executable
run: |
echo "tag: ${{ steps.changes.outputs.tag }}"
echo "changes: ${{ steps.changes.outputs.changes }}"
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }} deploy.txt
Copy-Item -Path "dist" -Destination "ok-ww" -Recurse
7z a -t7z -r "ok-ww-${{ steps.tagName.outputs.tag }}.7z" "ok-ww"
Remove-Item -Path "ok-ww" -Recurse -Force
shell: pwsh
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
下载 ok-ww.7z, Download ok-ww.7z
不要下载SourceCode Do Not Download the SourceCode
draft: false
prerelease: false
files: |
ok-ww-${{ steps.tagName.outputs.tag }}.7z
- name: push to ok-ww-update
run: |
python -m ok.update.push_repos --repos https://ok-oldking:${{ secrets.OK_GH }}@github.com/ok-oldking/ok-ww-update --files deploy.txt --tag ${{ steps.tagName.outputs.tag }}
- name: push to cnb
run: |
python -m ok.update.push_repos --repos https://cnb:${{ secrets.CNB_TOKEN }}@cnb.cool/ok-oldking/ok-wuthering-waves.git --files deploy.txt --tag ${{ steps.tagName.outputs.tag }}