Files
bg3-dnd55e-russian-localiza…/.gitea/workflows/build.yml
Shahovalov MIkhail d29022f8bf
All checks were successful
Build Mod Package / build (push) Successful in 6s
Use absolute paths for Divine package build
2026-04-07 23:44:10 +03:00

92 lines
3.1 KiB
YAML

name: Build Mod Package
on:
push:
branches:
- main
- master
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on:
- win11
defaults:
run:
shell: powershell
steps:
- name: Prepare workspace
run: |
$ErrorActionPreference = "Stop"
$workspace = "${{ gitea.workspace }}"
$repoUrl = "${{ gitea.server_url }}/${{ gitea.repository }}.git"
$repoRef = "${{ gitea.ref }}"
$authPair = "${{ gitea.actor }}:${{ secrets.GITEA_TOKEN }}"
$authBytes = [System.Text.Encoding]::ASCII.GetBytes($authPair)
$authBasic = [Convert]::ToBase64String($authBytes)
New-Item -ItemType Directory -Path $workspace -Force | Out-Null
Set-Location $workspace
if (-not (Test-Path -LiteralPath ".git")) {
git init | Out-Null
git remote add origin $repoUrl
} else {
git remote set-url origin $repoUrl
}
git -c "http.extraHeader=Authorization: Basic $authBasic" fetch --depth 1 origin $repoRef
git checkout --force FETCH_HEAD
if (-not (Test-Path -LiteralPath "Mods\\DnD55eRussian\\Localization\\Russian\\russian.xml")) {
throw "Repository sources are not available in the runner workspace."
}
New-Item -ItemType Directory -Path ".tools\\lslib" -Force | Out-Null
New-Item -ItemType Directory -Path "build" -Force | Out-Null
- name: Download latest LSLib release
run: |
$ErrorActionPreference = "Stop"
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/Norbyte/lslib/releases/latest"
$asset = $release.assets | Where-Object { $_.name -match '\.zip$' } | Select-Object -First 1
if (-not $asset) {
throw "Could not find a downloadable LSLib zip asset in the latest release."
}
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile ".tools/lslib/lslib.zip"
Expand-Archive -LiteralPath ".tools/lslib/lslib.zip" -DestinationPath ".tools/lslib" -Force
- name: Build .pak
run: |
$ErrorActionPreference = "Stop"
$workspace = "${{ gitea.workspace }}"
$modsPath = [System.IO.Path]::GetFullPath((Join-Path $workspace "Mods"))
$packagePath = [System.IO.Path]::GetFullPath((Join-Path $workspace "build/DnD55eRussian.pak"))
$divine = Get-ChildItem -Path ".tools/lslib" -Recurse -File |
Where-Object { $_.Name -ieq "Divine.exe" } |
Select-Object -First 1
if (-not $divine) {
throw "Divine.exe was not found in the downloaded LSLib release."
}
& $divine.FullName -a create-package -g bg3 -s $modsPath -d $packagePath
if (-not (Test-Path -LiteralPath "build/DnD55eRussian.pak")) {
throw "Package was not created."
}
- name: Show build result
run: |
$ErrorActionPreference = "Stop"
Get-ChildItem "build/DnD55eRussian.pak" | Select-Object FullName, Length, LastWriteTime