Skip to content

Commit 6d22b46

Browse files
committed
Add build + pre-release Github workflow
+ Create a pre-release from each commit, with downloadable mod build * Modify build scripts not to ask for input if $NONINTERACTIVE is set * Modify build scripts not to copy .dlls if $CI is set
1 parent 56f4a97 commit 6d22b46

File tree

4 files changed

+94
-27
lines changed

4 files changed

+94
-27
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
push:
3+
branches:
4+
- develop
5+
jobs:
6+
my_job:
7+
runs-on: windows-2025
8+
name: wtp
9+
steps:
10+
- name: checkout
11+
uses: actions/checkout@v4
12+
with:
13+
path: build
14+
- name: getcompiler
15+
uses: actions/checkout@v4
16+
with:
17+
path: Compiler
18+
repository: We-the-People-civ4col-mod/Compiler
19+
- name: cache
20+
uses: actions/cache@v3
21+
with:
22+
key: wtpcache
23+
path: |
24+
perl
25+
- name: build
26+
run: |
27+
$ProgressPreference = 'SilentlyContinue'
28+
if (Test-Path perl) {Write-Host "perl is cached"} else { Invoke-WebRequest "https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_54001_64bit_UCRT/strawberry-perl-5.40.0.1-64bit-portable.zip" -OutFile perl.zip ; Expand-Archive perl.zip perl }
29+
$Env:PATH += ";$(Resolve-Path -Path perl\c\bin);$(Resolve-Path -Path perl\perl\bin);$(Resolve-Path -Path perl\perl\site\bin)"
30+
cd "build\Project Files"
31+
$env:NO_FASTDEP = "1"
32+
$env:CI = "1"
33+
$env:NONINTERACTIVE = "1"
34+
& "./Get Compiler.bat"
35+
perl compile.pl
36+
cd ..
37+
git archive --format=zip --prefix=Assets/ --add-file=Assets/CvGameCoreDLL.dll --prefix= -9 head --output ../WeThePeople.zip
38+
- name: release
39+
uses: "marvinpinto/action-automatic-releases@v1.2.1"
40+
with:
41+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
42+
files: "WeThePeople.zip"
43+
automatic_release_tag: "development"
44+
prerelease: true
45+
title: "development build"

Project Files/Get Compiler.bat

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
SET PATH=%PATH%;"%ProgramFiles(x86)%\Git";"%ProgramFiles%\Git";"%ProgramFiles(x86)%\SmartGit\git\bin";"%ProgramFiles%\SmartGit\git\bin";
44

5-
if exist ..\..\Compiler (
6-
cd ..\..\Compiler
7-
git pull --rebase
8-
) else (
9-
git clone https://github.com/We-the-People-civ4col-mod/Compiler.git ..\..\Compiler
10-
cd ..\..\Compiler
11-
)
5+
if NOT "%CI%" == "1" (
6+
if exist ..\..\Compiler (
7+
cd ..\..\Compiler
8+
git pull --rebase
9+
) else (
10+
git clone https://github.com/We-the-People-civ4col-mod/Compiler.git ..\..\Compiler
11+
cd ..\..\Compiler
12+
)
1213

13-
if not exist ..\..\tbb.dll (
14-
echo Copying tbb.dll to Colonization.exe
15-
copy DLL_for_exe\tbb.dll ..\..\
16-
)
17-
if not exist ..\..\tbbmalloc.dll (
18-
echo Copying tbbmalloc.dll to Colonization.exe
19-
copy DLL_for_exe\tbbmalloc.dll ..\..\
14+
if not exist ..\..\tbb.dll (
15+
echo Copying tbb.dll to Colonization.exe
16+
copy DLL_for_exe\tbb.dll ..\..\
17+
)
18+
if not exist ..\..\tbbmalloc.dll (
19+
echo Copying tbbmalloc.dll to Colonization.exe
20+
copy DLL_for_exe\tbbmalloc.dll ..\..\
21+
)
2022
)
2123

2224
rem test is perl.exe is in PATH

Project Files/bin/Compile.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ bin\jom source_list /NOLOGO && ^
1212
nmake precompile /NOLOGO && ^
1313
bin\jom build
1414

15-
pause
15+
IF NOT "%NONINTERACTIVE%" == "1" (
16+
pause
17+
)

Project Files/compile.pl

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ sub menu
4747

4848
print "\n";
4949
print "Pick an option and press enter\n";
50-
51-
my $input = <STDIN>;
50+
my $input;
51+
if($ENV{NONINTERACTIVE})
52+
{
53+
$input = "6"
54+
}
55+
else
56+
{
57+
$input = <STDIN>;
58+
}
5259
chomp $input;
5360

5461
if ($input eq "1")
@@ -98,7 +105,16 @@ sub createBatMenu
98105
{
99106
print "Select type of DLL file, which should be used when starting with the bat file.\n";
100107
printListOfDLLs();
101-
my $input = <STDIN>;
108+
my $input;
109+
if($ENV{NONINTERACTIVE})
110+
{
111+
$input = "6";
112+
}
113+
else
114+
{
115+
$input = <STDIN>;
116+
};
117+
102118
chomp $input;
103119

104120
if ($input eq "1")
@@ -181,14 +197,16 @@ sub createBat
181197

182198
close(FH);
183199

184-
print "Creation of $filename complete.\n\n";
185-
print "Feel free to move it to a more conventient location (like desktop).\n";
186-
print "Note that it's custom made for the file paths on this specific computer.\n";
187-
print "Do not except it to work on other computers. They will have to make their own bat files.\n";
188-
print "\nPress enter to continue.\n";
189-
190-
<STDIN>
191-
200+
if(!$ENV{NONINTERACTIVE})
201+
{
202+
print "Creation of $filename complete.\n\n";
203+
print "Feel free to move it to a more conventient location (like desktop).\n";
204+
print "Note that it's custom made for the file paths on this specific computer.\n";
205+
print "Do not except it to work on other computers. They will have to make their own bat files.\n";
206+
print "\nPress enter to continue.\n";
207+
208+
<STDIN>
209+
}
192210
}
193211

194212
sub help
@@ -255,4 +273,4 @@ sub help
255273
print "\n\nPress enter to continue\n";
256274
<STDIN>;
257275
$OUTPUT_SCREEN->Cls;
258-
}
276+
}

0 commit comments

Comments
 (0)