mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-23 05:45:37 +08:00
action (#164)
This commit is contained in:
parent
245259e0cc
commit
a900de60ef
139
.github/workflows/release.yml
vendored
139
.github/workflows/release.yml
vendored
@ -4,60 +4,51 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
loadversion:
|
||||||
|
runs-on: windows-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.loadversion.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- id: loadversion
|
||||||
|
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||||
build_xp:
|
build_xp:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
|
needs: loadversion
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
language: [Chinese,English,Russian,TradChinese]
|
||||||
- target: Release_English_winxp
|
|
||||||
- target: Release_Chinese_winxp
|
|
||||||
- target: Release_Russian_winxp
|
|
||||||
- target: Release_TradChinese_winxp
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
attestations: write
|
attestations: write
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
||||||
- name: Setup Windows 10 SDK
|
|
||||||
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
|
||||||
with:
|
with:
|
||||||
sdk-version: 22621
|
sdk-version: 22621
|
||||||
- name: Install Python 3.11
|
- run: python build.py build ${{ matrix.language }} winxp
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
architecture: x64
|
|
||||||
|
|
||||||
- name: Run build script
|
- run: python scripts/pack.py
|
||||||
run: python build.py ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Pack
|
|
||||||
run: python build.py pack
|
|
||||||
|
|
||||||
# - name: Generate attestation for artifact
|
# - name: Generate attestation for artifact
|
||||||
# uses: actions/attest-build-provenance@v1
|
# uses: actions/attest-build-provenance@v1
|
||||||
# with:
|
# with:
|
||||||
# subject-path: builds/${{ matrix.target }}.zip
|
# subject-path: builds/${{ matrix.target }}.zip
|
||||||
- name: Upload artifact
|
- uses: actions/upload-artifact@v4
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.target }}
|
name: ${{ matrix.language }}_winxp
|
||||||
path: builds/${{ matrix.target }}.zip
|
path: builds/Release_${{ matrix.language }}_winxp.zip
|
||||||
- name: loadversion
|
- uses: softprops/action-gh-release@v2
|
||||||
id: loadversion
|
|
||||||
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
||||||
- name: Release LunaHook
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.loadversion.outputs.version }}
|
tag_name: ${{ needs.loadversion.outputs.version }}
|
||||||
files: builds/${{ matrix.target }}.zip
|
files: builds/Release_${{ matrix.language }}_winxp.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
build_plugin:
|
build_plugin:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
needs: [loadversion]
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@ -72,15 +63,12 @@ jobs:
|
|||||||
attestations: write
|
attestations: write
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
||||||
- name: Setup Windows 10 SDK
|
|
||||||
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
|
||||||
with:
|
with:
|
||||||
sdk-version: 22621
|
sdk-version: 22621
|
||||||
|
|
||||||
- name: Install Qt
|
- uses: jurplel/install-qt-action@v3.3.0
|
||||||
uses: jurplel/install-qt-action@v3.3.0
|
|
||||||
with:
|
with:
|
||||||
version: 5.15.2
|
version: 5.15.2
|
||||||
host: windows
|
host: windows
|
||||||
@ -88,79 +76,58 @@ jobs:
|
|||||||
arch: ${{ matrix.qtarch }}
|
arch: ${{ matrix.qtarch }}
|
||||||
dir: ${{ runner.temp }}
|
dir: ${{ runner.temp }}
|
||||||
setup-python: true
|
setup-python: true
|
||||||
- name: Run build script
|
- run: python build.py ${{ matrix.cmd }}
|
||||||
run: python build.py ${{ matrix.cmd }}
|
|
||||||
|
|
||||||
- name: Pack
|
- run: python scripts/pack.py
|
||||||
run: python build.py pack
|
|
||||||
|
|
||||||
# - name: Generate attestation for artifact
|
# - name: Generate attestation for artifact
|
||||||
# uses: actions/attest-build-provenance@v1
|
# uses: actions/attest-build-provenance@v1
|
||||||
# with:
|
# with:
|
||||||
# subject-path: builds/${{ matrix.target }}.zip
|
# subject-path: builds/${{ matrix.target }}.zip
|
||||||
- name: Upload artifact
|
- uses: actions/upload-artifact@v4
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.target }}
|
name: ${{ matrix.target }}
|
||||||
path: builds/${{ matrix.target }}.zip
|
path: builds/${{ matrix.target }}.zip
|
||||||
- name: loadversion
|
- uses: softprops/action-gh-release@v2
|
||||||
id: loadversion
|
|
||||||
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
||||||
- name: Release LunaHook
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.loadversion.outputs.version }}
|
tag_name: ${{ needs.loadversion.outputs.version }}
|
||||||
files: builds/${{ matrix.target }}.zip
|
files: builds/${{ matrix.target }}.zip
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_everylang:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
language: [Chinese,English,Russian,TradChinese]
|
||||||
- target: Release_English
|
bits: [32, 64]
|
||||||
- target: Release_Chinese
|
|
||||||
- target: Release_Russian
|
|
||||||
- target: Release_TradChinese
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
attestations: write
|
attestations: write
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
||||||
- name: Setup Windows 10 SDK
|
|
||||||
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
|
||||||
with:
|
with:
|
||||||
sdk-version: 22621
|
sdk-version: 22621
|
||||||
- name: Install Python 3.11
|
- run: python build.py build ${{ matrix.language }} ${{matrix.bits}}
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
architecture: x64
|
|
||||||
- name: Run build script
|
|
||||||
run: python build.py ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Pack
|
- uses: actions/upload-artifact@v4
|
||||||
run: python build.py pack
|
|
||||||
|
|
||||||
# - name: Generate attestation for artifact
|
|
||||||
# uses: actions/attest-build-provenance@v1
|
|
||||||
# with:
|
|
||||||
# subject-path: builds/${{ matrix.target }}.zip
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.target }}
|
name: ${{ matrix.language }}_${{matrix.bits}}
|
||||||
path: builds/${{ matrix.target }}.zip
|
path: builds
|
||||||
- name: loadversion
|
|
||||||
id: loadversion
|
|
||||||
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
||||||
- name: Release LunaHook
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: ${{ steps.loadversion.outputs.version }}
|
|
||||||
files: builds/${{ matrix.target }}.zip
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: windows-latest
|
||||||
|
needs: [build, loadversion]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: build
|
||||||
|
- run: python build.py merge
|
||||||
|
- uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ needs.loadversion.outputs.version }}
|
||||||
|
files: builds/*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
83
build.py
83
build.py
@ -1,7 +1,9 @@
|
|||||||
import os, sys, re
|
import os, sys, re, shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
rootDir = os.path.dirname(__file__)
|
rootDir = os.path.dirname(__file__)
|
||||||
|
if not rootDir:
|
||||||
|
rootDir = os.path.abspath(".")
|
||||||
if len(sys.argv) and sys.argv[1] == "loadversion":
|
if len(sys.argv) and sys.argv[1] == "loadversion":
|
||||||
os.chdir(rootDir)
|
os.chdir(rootDir)
|
||||||
with open("CMakeLists.txt", "r", encoding="utf8") as ff:
|
with open("CMakeLists.txt", "r", encoding="utf8") as ff:
|
||||||
@ -11,10 +13,34 @@ if len(sys.argv) and sys.argv[1] == "loadversion":
|
|||||||
versionstring = f"v{version_major}.{version_minor}.{version_patch}"
|
versionstring = f"v{version_major}.{version_minor}.{version_patch}"
|
||||||
print("version=" + versionstring)
|
print("version=" + versionstring)
|
||||||
exit()
|
exit()
|
||||||
|
if len(sys.argv) and sys.argv[1] == "merge":
|
||||||
|
os.mkdir("../build")
|
||||||
|
os.mkdir("builds")
|
||||||
|
language = ["Chinese", "English", "Russian", "TradChinese"]
|
||||||
|
bits = [32, 64]
|
||||||
|
for lang in language:
|
||||||
|
for bit in bits:
|
||||||
|
shutil.copytree(
|
||||||
|
f"build/{lang}_{bit}/Release_{lang}",
|
||||||
|
f"../build/Release_{lang}",
|
||||||
|
dirs_exist_ok=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
targetdir = f"../build/Release_{lang}"
|
||||||
|
target = f"builds/Release_{lang}.zip"
|
||||||
|
os.system(
|
||||||
|
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
|
||||||
|
)
|
||||||
|
exit()
|
||||||
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
|
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
|
||||||
vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
|
vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
|
||||||
|
|
||||||
|
|
||||||
|
print(sys.version)
|
||||||
|
print(__file__)
|
||||||
|
print(rootDir)
|
||||||
|
|
||||||
|
|
||||||
def installVCLTL():
|
def installVCLTL():
|
||||||
os.chdir(rootDir)
|
os.chdir(rootDir)
|
||||||
if os.path.exists("temp"):
|
if os.path.exists("temp"):
|
||||||
@ -25,18 +51,22 @@ def installVCLTL():
|
|||||||
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
|
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
|
||||||
|
|
||||||
|
|
||||||
def build_langx(lang):
|
def build_langx(lang, bit):
|
||||||
with open("do.bat", "w") as ff:
|
with open("do.bat", "w") as ff:
|
||||||
ff.write(
|
if bit == "32":
|
||||||
rf"""
|
ff.write(
|
||||||
|
rf"""
|
||||||
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang}
|
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang}
|
||||||
cmake --build ../build/x86_{lang} --config Release --target ALL_BUILD -j 14
|
cmake --build ../build/x86_{lang} --config Release --target ALL_BUILD -j 14
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
elif bit == "64":
|
||||||
|
ff.write(
|
||||||
|
rf"""
|
||||||
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_{lang}
|
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_{lang}
|
||||||
cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
|
cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
|
||||||
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
os.system(f"cmd /c do.bat")
|
os.system(f"cmd /c do.bat")
|
||||||
|
|
||||||
|
|
||||||
@ -53,29 +83,16 @@ call dobuildxp.bat
|
|||||||
os.system(f"cmd /c do.bat")
|
os.system(f"cmd /c do.bat")
|
||||||
|
|
||||||
|
|
||||||
if sys.argv[1] == "pack":
|
installVCLTL()
|
||||||
os.chdir(os.path.join(rootDir, "scripts"))
|
os.chdir(os.path.join(rootDir, "scripts"))
|
||||||
os.system(f"python pack.py pack")
|
if sys.argv[1] == "plg32":
|
||||||
else:
|
os.system(f"cmd /c buildplugin32.bat")
|
||||||
installVCLTL()
|
elif sys.argv[1] == "plg64":
|
||||||
os.chdir(os.path.join(rootDir, "scripts"))
|
os.system(f"cmd /c buildplugin64.bat")
|
||||||
if sys.argv[1] == "plg32":
|
elif sys.argv[1] == "build":
|
||||||
os.system(f"cmd /c buildplugin32.bat")
|
lang = sys.argv[2]
|
||||||
elif sys.argv[1] == "plg64":
|
bit = sys.argv[3]
|
||||||
os.system(f"cmd /c buildplugin64.bat")
|
if bit == "winxp":
|
||||||
elif sys.argv[1] == "Release_English":
|
build_langx_xp(lang)
|
||||||
build_langx("English")
|
else:
|
||||||
elif sys.argv[1] == "Release_Chinese":
|
build_langx(lang, bit)
|
||||||
build_langx("Chinese")
|
|
||||||
elif sys.argv[1] == "Release_Russian":
|
|
||||||
build_langx("Russian")
|
|
||||||
elif sys.argv[1] == "Release_TradChinese":
|
|
||||||
build_langx("TradChinese")
|
|
||||||
elif sys.argv[1] == "Release_English_winxp":
|
|
||||||
build_langx_xp("English")
|
|
||||||
elif sys.argv[1] == "Release_Chinese_winxp":
|
|
||||||
build_langx_xp("Chinese")
|
|
||||||
elif sys.argv[1] == "Release_Russian_winxp":
|
|
||||||
build_langx_xp("Russian")
|
|
||||||
elif sys.argv[1] == "Release_TradChinese_winxp":
|
|
||||||
build_langx_xp("TradChinese")
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import os, shutil, sys
|
import os, shutil, sys
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
for f in os.listdir("../builds"):
|
for f in os.listdir("../builds"):
|
||||||
if os.path.isdir("../builds/" + f) == False:
|
if os.path.isdir("../builds/" + f) == False:
|
||||||
@ -27,4 +29,6 @@ for f in os.listdir("../builds"):
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
targetdir = "../builds/" + f
|
targetdir = "../builds/" + f
|
||||||
target = "../builds/" + f + ".zip"
|
target = "../builds/" + f + ".zip"
|
||||||
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}')
|
os.system(
|
||||||
|
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user