mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-11-28 00:50:21 +08:00
149 lines
5.3 KiB
YAML
149 lines
5.3 KiB
YAML
name: _
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
createrelease:
|
|
type: boolean
|
|
default: false
|
|
required: false
|
|
jobs:
|
|
buildall:
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- arch: x86
|
|
target: winxp
|
|
- arch: x86
|
|
target: win7
|
|
pythonversion: '3.7.9'
|
|
- arch: x64
|
|
target: win7
|
|
pythonversion: '3.7.9'
|
|
- arch: x64
|
|
target: win10
|
|
pythonversion: '3.12.10'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
# - uses: microsoft/setup-msbuild@v2
|
|
- if: matrix.target == 'winxp'
|
|
run: |
|
|
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
|
|
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
|
|
$componentsToAdd = @(
|
|
"Microsoft.VisualStudio.Component.WinXP"
|
|
)
|
|
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
|
|
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
|
|
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
|
|
if ($process.ExitCode -eq 0)
|
|
{
|
|
Write-Host "components have been successfully added"
|
|
Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.*
|
|
}
|
|
else
|
|
{
|
|
Write-Host "components were not installed"
|
|
exit 1
|
|
}
|
|
# - uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
|
|
# with:
|
|
# sdk-version: 26100
|
|
- if: matrix.target != 'winxp'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.pythonversion }}
|
|
architecture: ${{ matrix.arch }}
|
|
- if: matrix.target != 'win10'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.12.10
|
|
architecture: x64
|
|
- run: C:\hostedtoolcache\windows\Python\3.12.10\x64\python src/scripts/build_lunatranslator.py cpp ${{ matrix.arch }} ${{ matrix.target }}
|
|
- run: C:\hostedtoolcache\windows\Python\3.12.10\x64\python src/scripts/build_lunatranslator.py hook ${{ matrix.arch }} ${{ matrix.target }}
|
|
- if: matrix.target != 'winxp'
|
|
run: C:\hostedtoolcache\windows\Python\3.12.10\x64\python src/scripts/build_lunatranslator.py pyrt ${{ matrix.arch }} ${{ matrix.pythonversion }} ${{ matrix.target }}
|
|
- run: C:\hostedtoolcache\windows\Python\3.12.10\x64\python src/scripts/build_lunatranslator.py merge ${{ matrix.arch }} ${{ matrix.target }}
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: LunaTranslator_${{ matrix.arch }}_${{ matrix.target }}
|
|
path: src/build/LunaTranslator_${{ matrix.arch }}_${{ matrix.target }}
|
|
|
|
# - uses: actions/attest-build-provenance@v2.2.0
|
|
# with:
|
|
# subject-path: src/build/LunaTranslator_${{ matrix.arch }}_${{ matrix.target }}
|
|
|
|
signandrepack:
|
|
runs-on: windows-latest
|
|
needs: [buildall]
|
|
permissions:
|
|
contents: write
|
|
pages: write
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: build
|
|
- run: python src/scripts/build_lunatranslator.py exedlls
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
id: upload-artifact
|
|
with:
|
|
name: exedlls
|
|
path: collect
|
|
|
|
- uses: signpath/github-action-submit-signing-request@v2
|
|
with:
|
|
api-token: '${{ secrets.SIGNPATH_APITOKEN }}'
|
|
organization-id: '2e2b9c90-04bb-4b70-8562-0171927d94c6'
|
|
project-slug: 'LunaTranslator'
|
|
signing-policy-slug: 'test-signing'
|
|
github-artifact-id: '${{ steps.upload-artifact.outputs.artifact-id }}'
|
|
wait-for-completion: true
|
|
output-artifact-directory: 'signed_exedlls'
|
|
artifact-configuration-slug: 'exedlls'
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: signed_exedlls
|
|
path: signed_exedlls
|
|
|
|
- run: python src/scripts/build_lunatranslator.py repack
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: signed
|
|
path: signed
|
|
|
|
|
|
loadversion:
|
|
if: ${{inputs.createrelease}}
|
|
runs-on: windows-latest
|
|
outputs:
|
|
version: ${{ steps.loadversion.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- id: loadversion
|
|
run: python src/scripts/build_lunatranslator.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
|
|
release:
|
|
if: ${{inputs.createrelease}}
|
|
runs-on: windows-latest
|
|
needs: [signandrepack,loadversion]
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: build
|
|
- uses: softprops/action-gh-release@v2.2.2
|
|
with:
|
|
tag_name: ${{ needs.loadversion.outputs.version }}
|
|
files: |
|
|
build/signed/LunaTranslator_x86_winxp.zip
|
|
build/signed/LunaTranslator_x86_win7.zip
|
|
build/signed/LunaTranslator_x64_win7.zip
|
|
build/signed/LunaTranslator_x64_win10.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|