196 lines
7.3 KiB
YAML
196 lines
7.3 KiB
YAML
# AUTO_MAA:A MAA Multi Account Management and Automation Tool
|
|
# Copyright © 2024-2025 DLmaster361
|
|
|
|
# This file is part of AUTO_MAA.
|
|
|
|
# AUTO_MAA is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License,
|
|
# or (at your option) any later version.
|
|
|
|
# AUTO_MAA is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
# the GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with AUTO_MAA. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# Contact: DLmaster_361@163.com
|
|
|
|
name: Build AUTO_MAA Test
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
actions: write
|
|
|
|
jobs:
|
|
|
|
pre_check:
|
|
name: Pre Checks
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Repo Check
|
|
id: repo_check
|
|
run: |
|
|
if [[ "$GITHUB_REPOSITORY" != "DLmaster361/AUTO_MAA" ]]; then
|
|
echo "When forking this repository to make your own builds, you have to adjust this check."
|
|
exit 1
|
|
fi
|
|
exit 0
|
|
|
|
build_AUTO_MAA:
|
|
runs-on: windows-latest
|
|
needs: pre_check
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install flake8 pytest
|
|
pip install -r requirements.txt
|
|
|
|
- name: Lint with flake8
|
|
run: |
|
|
# stop the build if there are Python syntax errors or undefined names
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
|
|
- name: Get version
|
|
id: get_version
|
|
run: |
|
|
$version = (Get-Content resources/version.json | ConvertFrom-Json).main_version
|
|
echo "main_version=$version" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Nuitka build main program
|
|
uses: Nuitka/Nuitka-Action@main
|
|
with:
|
|
script-name: main.py
|
|
mode: app
|
|
enable-plugins: pyside6
|
|
onefile-tempdir-spec: "{TEMP}/AUTO_MAA"
|
|
windows-console-mode: disable
|
|
windows-icon-from-ico: resources/icons/AUTO_MAA.ico
|
|
company-name: AUTO_MAA Team
|
|
product-name: AUTO_MAA
|
|
file-version: ${{ steps.get_version.outputs.main_version }}
|
|
product-version: ${{ steps.get_version.outputs.main_version }}
|
|
file-description: AUTO_MAA Component
|
|
copyright: Copyright © 2024-2025 DLmaster361
|
|
assume-yes-for-downloads: true
|
|
output-file: AUTO_MAA
|
|
output-dir: AUTO_MAA
|
|
|
|
- name: Upload unsigned artifact
|
|
id: upload-unsigned-artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
path: AUTO_MAA/AUTO_MAA.exe
|
|
|
|
- name: Sign main program
|
|
id: sign_main_program
|
|
uses: signpath/github-action-submit-signing-request@v1.2
|
|
with:
|
|
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
|
|
organization-id: '787a1d5f-6177-4f30-9559-d2646473584a'
|
|
project-slug: 'AUTO_MAA_'
|
|
signing-policy-slug: 'test-signing'
|
|
artifact-configuration-slug: "single-exe"
|
|
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
|
|
wait-for-completion: true
|
|
output-artifact-directory: 'AUTO_MAA'
|
|
|
|
- name: Add other resources
|
|
shell: pwsh
|
|
run: |
|
|
$root = "${{ github.workspace }}"
|
|
$ver = "${{ steps.get_version.outputs.main_version }}"
|
|
Copy-Item "$root/app" "$root/AUTO_MAA/app" -Recurse
|
|
Copy-Item "$root/resources" "$root/AUTO_MAA/resources" -Recurse
|
|
Copy-Item "$root/main.py" "$root/AUTO_MAA/"
|
|
Copy-Item "$root/requirements.txt" "$root/AUTO_MAA/"
|
|
Copy-Item "$root/README.md" "$root/AUTO_MAA/"
|
|
Copy-Item "$root/LICENSE" "$root/AUTO_MAA/"
|
|
|
|
- name: Create Inno Setup script
|
|
shell: pwsh
|
|
run: |
|
|
$root = "${{ github.workspace }}"
|
|
$ver = "${{ steps.get_version.outputs.main_version }}"
|
|
$iss = Get-Content "$root/app/utils/AUTO_MAA.iss" -Raw
|
|
$iss = $iss -replace '#define MyAppVersion ""', "#define MyAppVersion `"$ver`""
|
|
$iss = $iss -replace '#define MyAppPath ""', "#define MyAppPath `"$root/AUTO_MAA`""
|
|
$iss = $iss -replace '#define OutputDir ""', "#define OutputDir `"$root`""
|
|
Set-Content -Path "$root/AUTO_MAA.iss" -Value $iss
|
|
|
|
- name: Build setup program
|
|
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
|
|
with:
|
|
path: AUTO_MAA.iss
|
|
|
|
- name: Compress setup exe
|
|
shell: pwsh
|
|
run: |
|
|
$root = "${{ github.workspace }}"
|
|
New-Item -ItemType Directory -Force -Path "$root/AUTO_MAA_Setup"
|
|
Move-Item "$root/AUTO_MAA-Setup.exe" "$root/AUTO_MAA_Setup/"
|
|
Compress-Archive -Path AUTO_MAA_Setup/* -DestinationPath AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip
|
|
|
|
- name: Generate version info
|
|
shell: python
|
|
run: |
|
|
import json
|
|
from pathlib import Path
|
|
def version_text(version_numb):
|
|
while len(version_numb) < 4:
|
|
version_numb.append(0)
|
|
if version_numb[3] == 0:
|
|
return f"v{'.'.join(str(_) for _ in version_numb[0:3])}"
|
|
else:
|
|
return f"v{'.'.join(str(_) for _ in version_numb[0:3])}-beta.{version_numb[3]}"
|
|
def version_info_markdown(info):
|
|
version_info = ""
|
|
for key, value in info.items():
|
|
version_info += f"## {key}\n"
|
|
for v in value:
|
|
version_info += f"- {v}\n"
|
|
return version_info
|
|
root_path = Path(".")
|
|
version = json.loads((root_path / "resources/version.json").read_text(encoding="utf-8"))
|
|
main_version_numb = list(map(int, version["main_version"].split(".")))
|
|
all_version_info = {}
|
|
for v_i in version["version_info"].values():
|
|
for key, value in v_i.items():
|
|
if key in all_version_info:
|
|
all_version_info[key] += value.copy()
|
|
else:
|
|
all_version_info[key] = value.copy()
|
|
(root_path / "version_info.txt").write_text(
|
|
f"{version_text(main_version_numb)}\n\n<!--{json.dumps(version['version_info'], ensure_ascii=False)}-->\n{version_info_markdown(all_version_info)}",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: AUTO_MAA_${{ steps.get_version.outputs.main_version }}
|
|
path: AUTO_MAA_${{ steps.get_version.outputs.main_version }}.zip
|
|
|
|
- name: Upload Version_Info Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: version_info
|
|
path: version_info.txt |