Add README #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
workflow_call: | |
inputs: | |
version: | |
type: string | |
description: 'Build version' | |
required: true | |
default: '' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Build version' | |
required: true | |
default: '' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ windows-2022 ] | |
toolkit: [ 14.29, 14.39 ] | |
include: | |
- os: windows-2019 | |
toolkit: 14.29 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: TheMrMilchmann/setup-msvc-dev@v3 | |
with: | |
arch: amd64_x86 | |
toolset: ${{ matrix.toolkit }} | |
export-path-to-vcvarsall: VCVARSALL | |
- name: Setup CMake Ninja Multi-Config | |
run: cmake -G "Ninja Multi-Config" --preset x86-multi-config -S . -B out/build/x86-multi-config | |
- name: CMake Build | |
run: cmake --build out/build/x86-multi-config --target all -j 16 | |
- name: CMake Install | |
run: cmake --build out/build/x86-multi-config --target install | |
- name: Convert version to toolkit | |
id: convert-version | |
env: | |
OS: ${{ matrix.os }} | |
MSVC_VERSION: ${{ matrix.toolkit }} | |
VERSION: ${{ inputs.version }} | |
run: | | |
$TOOLKIT="" | |
echo "MSVC_VERSION = $env:MSVC_VERSION" | |
if ($env:MSVC_VERSION -match "^14\.2[0-9]$") { $TOOLKIT="v142" } | |
if ($env:MSVC_VERSION -match "^14\.[34][0-9]$") { $TOOLKIT="v143" } | |
echo "TOOLKIT = $TOOLKIT" | |
mkdir out/publish | |
$submodules = echo $(git submodule status) | |
Set-Content -Path out/install/x86-multi-config/submodules.ref.txt -Value $submodules | |
$unionApiRef = git submodule status union-api | %{($_ -split "\s+")[1]} | |
$gothicApiRef = git submodule status gothic-api | %{($_ -split "\s+")[1]} | |
Set-Content -Path out/install/x86-multi-config/union-api.ref.txt -Value $unionApiRef | |
Set-Content -Path out/install/x86-multi-config/gothic-api.ref.txt -Value $gothicApiRef | |
$date = Get-Date -Format 'yyyy.MM.ddTHH.mm' | |
Set-Content -Path out/install/x86-multi-config/build-time.txt -Value $date | |
$os = $env:OS | |
$version = $env:VERSION | |
if ($version -eq '') { | |
$filename = "UnionAPI-$TOOLKIT-$os-$date.zip" | |
} else { | |
$filename = "UnionAPI-$TOOLKIT-$os-$version.zip" | |
} | |
echo "filename=$filename" >> $env:GITHUB_OUTPUT | |
Compress-Archive out/install/x86-multi-config/* out/publish/$filename | |
$fileToHash = Get-Content -Path out/publish/$filename | |
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256') | |
$hashObject = $hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($fileToHash)) | |
$hash = [System.BitConverter]::ToString($hashObject) | |
$hash.Replace('-', '') | |
$hash = Get-FileHash -Path out/publish/$filename -Algorithm SHA256 | Select-Object Hash | |
Set-Content -Path out/publish/$filename.sha256 -Value $hash | |
- name: Archive ZIP | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.convert-version.outputs.filename }} | |
path: out/publish/* |