Skip to content

HAEMOLACRIA

HAEMOLACRIA #991

Workflow file for this run

name: Build Project and Upload Release
on:
workflow_dispatch:
push:
branches:
- main
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: windows-latest
if: "${{ github.event_name == 'workflow_dispatch' }}"
permissions:
contents: write
outputs:
version: ${{ steps.changelog.outputs.version }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0
- name: Generate changelog
id: changelog
run: |
echo "return [[" > ${{github.workspace}}/repentogon/resources/scripts/repentogon_extras/changelog_official_text.lua
Get-Content ${{github.workspace}}/changelog.txt -Raw >> ${{github.workspace}}/repentogon/resources/scripts/repentogon_extras/changelog_official_text.lua
echo "]]" >> ${{github.workspace}}/repentogon/resources/scripts/repentogon_extras/changelog_official_text.lua
echo "Resulting lua file:"
type ${{github.workspace}}/repentogon/resources/scripts/repentogon_extras/changelog_official_text.lua
echo "#pragma once" > ${{github.workspace}}/repentogon/Version.h
$version = Get-Content ${{github.workspace}}/version.txt -Raw
echo "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "#define VERSION `"$version`"" >> ${{github.workspace}}/repentogon/Version.h
(gc ${{github.workspace}}/repentogon/resources/scripts/main_ex.lua) -replace 'dev build', "$version" | Out-File -encoding ASCII ${{github.workspace}}/repentogon/resources/scripts/main_ex.lua
(gc ${{github.workspace}}/updater/Updater.cpp) -replace 'std::string version = "dev build";', "std::string version = `"$version`";" | Out-File -encoding ASCII ${{github.workspace}}/updater/Updater.cpp
- name: Configure CMake
run: cmake -G "Visual Studio 17 2022" -A "Win32" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Create Artifact Folder
shell: powershell
run: |
cd ${{github.workspace}}/build/Release
mkdir artifact
mv resources artifact
mv resources-repentogon artifact
mv dsound.dll artifact
mv libzhl.dll artifact
mv zhlREPENTOGON.dll artifact
mv Lua5.4.dll artifact
mv freetype.dll artifact
Install-Module Microsoft.PowerShell.Archive -MinimumVersion 1.2.3.0 -Repository PSGallery -Force
Import-Module Microsoft.PowerShell.Archive
Compress-Archive -Path artifact/* -Destination REPENTOGON.zip
mkdir ${{github.workspace}}/workshop/REPENTOGON
Copy-Item artifact/* ${{github.workspace}}/workshop/REPENTOGON
$PSDefaultParameterValues['*:Encoding'] = 'Default'
$OutputEncoding = [System.Text.Utf8Encoding]::new($false)
Get-FileHash .\REPENTOGON.zip | Select-Object -ExpandProperty Hash > hash.txt
- name: Upload release
uses: ncipollo/release-action@v1
with:
artifacts: "${{github.workspace}}/build/Release/REPENTOGON.zip,${{github.workspace}}/build/Release/hash.txt"
tag: ${{steps.changelog.outputs.version}}
token: ${{ secrets.GITHUB_TOKEN }}