Skip to content

Commit d2341b1

Browse files
committed
Starlight build scripts
1 parent 178768e commit d2341b1

2 files changed

Lines changed: 5 additions & 165 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ jobs:
1414
uses: actions/github-script@v6
1515
with:
1616
script: |
17-
let buildType = "Development";
18-
if (context.ref == "refs/heads/master" && context.repo.owner == "BepInEx") {
19-
buildType = "BleedingEdge";
20-
}
17+
let buildType = "Starlight";
2118
core.setOutput("build_type", buildType);
2219
let shortHash = "";
2320
await exec.exec("git", ["rev-parse", "--short", "HEAD"], {
@@ -27,50 +24,12 @@ jobs:
2724
});
2825
core.setOutput("sha_short", shortHash);
2926
core.setOutput("build_id", context.runNumber + 600); // builds.bepinex.dev build numbers start at 500
30-
- uses: nrwl/last-successful-commit-action@v1
31-
id: last_successful_commit
32-
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' }}
33-
with:
34-
branch: master
35-
workflow_id: build.yml
36-
github_token: ${{ secrets.GITHUB_TOKEN }}
3727
- uses: actions/setup-dotnet@v4
3828
with:
3929
dotnet-version: "10.0.x"
4030
- name: Build
4131
run: |
4232
./build.sh --target Publish --build-type ${{ steps.info.outputs.build_type }} --build-id ${{ steps.info.outputs.build_id }} --last-build-commit \"${{ steps.last_successful_commit.outputs.commit_hash }}\" --nuget-api-key \"${{ secrets.BEPIN_DEV_NUGET_KEY }}\"
43-
- name: Upload to BepinBuilds
44-
env:
45-
BEPISBUILDS_HOST: ${{ secrets.BEPISBUILDS_HOST }}
46-
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' && env.BEPISBUILDS_HOST != null }}
47-
run: |
48-
artifacts_list=$(find ./bin/dist -maxdepth 1 -type f | tr '\n' ','); artifacts_list=${artifacts_list::-1};
49-
curl --upload-file "{${artifacts_list}}" --ftp-pasv --ftp-skip-pasv-ip --ftp-create-dirs --ftp-method singlecwd --disable-epsv "ftp://${{ secrets.BEPISBUILDS_AUTH }}@${{ secrets.BEPISBUILDS_HOST }}:${{ secrets.BEPISBUILDS_PORT }}/bepinex_be/artifacts/${{ steps.info.outputs.build_id }}/"
50-
- name: Generate changelog
51-
id: generate_changelog
52-
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' }}
53-
run: |
54-
changelog=$(git --no-pager log --no-merges --pretty="format:- (\`%h\`) [%an] %s" ${{ steps.last_successful_commit.outputs.commit_hash }}..HEAD | sed ':a;N;$!ba;s/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g')
55-
echo "::set-output name=changelog::$changelog"
56-
- name: Notify success
57-
uses: joelwmale/webhook-action@2.4.1
58-
env:
59-
BEPINEX_DISCORD_WEBHOOK: ${{ secrets.BEPINEX_DISCORD_WEBHOOK }}
60-
if: ${{ steps.info.outputs.build_type == 'BleedingEdge' && env.BEPINEX_DISCORD_WEBHOOK != null }}
61-
with:
62-
url: ${{ secrets.BEPINEX_DISCORD_WEBHOOK }}
63-
body: |
64-
{
65-
"embeds": [
66-
{
67-
"title": "BepInEx Bleeding Edge build #${{ steps.info.outputs.build_id }}",
68-
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
69-
"color": 1559874,
70-
"description": "Changelog:\n\n${{ steps.generate_changelog.outputs.changelog }}\n\n[**Artifacts on BepInBuilds**](https://builds.bepinex.dev/projects/bepinex_be)"
71-
}
72-
]
73-
}
7433
- name: Upload Artifacts
7534
uses: actions/upload-artifact@v4
7635
with:

build/Program.cs

Lines changed: 4 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,14 @@ public enum ProjectBuildType
2929
{
3030
Release,
3131
Development,
32-
BleedingEdge
32+
BleedingEdge,
33+
Starlight
3334
}
3435

35-
public const string DoorstopVersion = "4.3.0";
36-
public const string DotnetRuntimeVersion = "6.0.7";
37-
public const string DobbyVersion = "1.0.5";
38-
39-
public const string DotnetRuntimeZipUrl =
40-
$"https://github.com/BepInEx/dotnet-runtime/releases/download/{DotnetRuntimeVersion}/mini-coreclr-Release.zip";
41-
4236
internal readonly DistributionTarget[] Distributions =
4337
{
44-
new("Unity.Mono", "win-x86"),
45-
new("Unity.Mono", "win-x64"),
46-
new("Unity.Mono", "linux-x86"),
47-
new("Unity.Mono", "linux-x64"),
48-
new("Unity.Mono", "macos-x64"),
49-
new("Unity.IL2CPP", "win-x86"),
50-
new("Unity.IL2CPP", "win-x64"),
51-
new("Unity.IL2CPP", "linux-x64"),
52-
new("Unity.IL2CPP", "macos-x64"),
53-
new("NET.Framework", "win-x86", "net40"),
54-
new("NET.Framework", "win-x86", "net452"),
55-
new("NET.CoreCLR", "win-x64", "netcoreapp3.1"),
56-
new("NET.CoreCLR", "win-x64", "net6.0")
38+
new("Unity.IL2CPP", "android-arm64"),
39+
new("Unity.IL2CPP", "android-arm"),
5740
};
5841

5942

@@ -104,12 +87,6 @@ public BuildContext(ICakeContext ctx)
10487
ProjectBuildType.Release => "",
10588
var _ => $"-{VersionSuffix}+{this.GitShortenSha(RootDirectory, CurrentCommit)}",
10689
};
107-
108-
public static string DoorstopZipUrl(string arch) =>
109-
$"https://github.com/NeighTools/UnityDoorstop/releases/download/v{DoorstopVersion}/doorstop_{arch}_release_{DoorstopVersion}.zip";
110-
111-
public static string DobbyZipUrl(string arch) =>
112-
$"https://github.com/BepInEx/Dobby/releases/download/v{DobbyVersion}/dobby-{arch}.zip";
11390
}
11491

11592
[TaskName("Clean")]
@@ -154,61 +131,8 @@ public override void Run(BuildContext ctx)
154131
}
155132
}
156133

157-
[TaskName("DownloadDependencies")]
158-
public sealed class DownloadDependenciesTask : FrostingTask<BuildContext>
159-
{
160-
public override void Run(BuildContext ctx)
161-
{
162-
ctx.Log.Information("Downloading dependencies");
163-
ctx.CreateDirectory(ctx.CacheDirectory);
164-
165-
var cache = new DependencyCache(ctx, ctx.CacheDirectory.CombineWithFilePath("cache.json"));
166-
167-
cache.Refresh("NeighTools/UnityDoorstop", BuildContext.DoorstopVersion, () =>
168-
{
169-
ctx.Log.Information($"Downloading Doorstop {BuildContext.DoorstopVersion}");
170-
var doorstopDir = ctx.CacheDirectory.Combine("doorstop");
171-
ctx.CreateDirectory(doorstopDir);
172-
ctx.CleanDirectory(doorstopDir);
173-
var archs = new[] { "win", "linux", "macos" };
174-
var versions = archs
175-
.Select(a => ($"Doorstop ({a})",
176-
BuildContext.DoorstopZipUrl(a),
177-
doorstopDir.Combine($"doorstop_{a}")))
178-
.ToArray();
179-
ctx.DownloadZipFiles($"Doorstop {BuildContext.DoorstopVersion}", versions);
180-
});
181-
182-
cache.Refresh("BepInEx/Dobby", BuildContext.DobbyVersion, () =>
183-
{
184-
ctx.Log.Information($"Downloading Dobby {BuildContext.DobbyVersion}");
185-
var dobbyDir = ctx.CacheDirectory.Combine("dobby");
186-
ctx.CreateDirectory(dobbyDir);
187-
ctx.CleanDirectory(dobbyDir);
188-
var archs = new[] { "win", "linux", "macos" };
189-
var versions = archs
190-
.Select(a => ($"Dobby ({a})", BuildContext.DobbyZipUrl(a), dobbyDir.Combine($"dobby_{a}")))
191-
.ToArray();
192-
ctx.DownloadZipFiles($"Dobby {BuildContext.DobbyVersion}", versions);
193-
});
194-
195-
cache.Refresh("BepInEx/dotnet_runtime", BuildContext.DotnetRuntimeVersion, () =>
196-
{
197-
ctx.Log.Information($"Downloading dotnet runtime {BuildContext.DotnetRuntimeVersion}");
198-
var dotnetDir = ctx.CacheDirectory.Combine("dotnet");
199-
ctx.CreateDirectory(dotnetDir);
200-
ctx.CleanDirectory(dotnetDir);
201-
ctx.DownloadZipFiles($"dotnet-runtime {BuildContext.DotnetRuntimeVersion}",
202-
("dotnet runtime", BuildContext.DotnetRuntimeZipUrl, dotnetDir));
203-
});
204-
205-
cache.Save();
206-
}
207-
}
208-
209134
[TaskName("MakeDist")]
210135
[IsDependentOn(typeof(CompileTask))]
211-
[IsDependentOn(typeof(DownloadDependenciesTask))]
212136
public sealed class MakeDistTask : FrostingTask<BuildContext>
213137
{
214138
public override void Run(BuildContext ctx)
@@ -250,49 +174,6 @@ public override void Run(BuildContext ctx)
250174

251175
foreach (var filePath in ctx.GetFiles(sourceDirectory.Combine("*.*").FullPath))
252176
ctx.CopyFileToDirectory(filePath, bepInExCoreDir);
253-
254-
if (dist.Engine == "Unity")
255-
{
256-
var doorstopPath =
257-
ctx.CacheDirectory.Combine("doorstop").Combine($"doorstop_{dist.Os}").Combine(dist.Arch);
258-
foreach (var filePath in ctx.GetFiles(doorstopPath.Combine($"*.{dist.DllExtension}").FullPath))
259-
ctx.CopyFileToDirectory(filePath, targetDir);
260-
ctx.CopyFileToDirectory(doorstopPath.CombineWithFilePath(".doorstop_version"), targetDir);
261-
var (doorstopConfigFile, doorstopConfigDistName) = dist.Os switch
262-
{
263-
"win" => ($"doorstop_config_{dist.Runtime.ToLower()}.ini",
264-
"doorstop_config.ini"),
265-
"linux" or "macos" => ($"run_bepinex_{dist.Runtime.ToLower()}.sh",
266-
"run_bepinex.sh"),
267-
var _ => throw new
268-
NotSupportedException(
269-
$"Doorstop is not supported on {dist.Os}")
270-
};
271-
ctx.CopyFile(ctx.RootDirectory.Combine("Runtimes").Combine("Unity").Combine("Doorstop").CombineWithFilePath(doorstopConfigFile),
272-
targetDir.CombineWithFilePath(doorstopConfigDistName));
273-
274-
if (dist.Runtime == "IL2CPP")
275-
{
276-
ctx.CopyFile(ctx.CacheDirectory.Combine("dobby").Combine($"dobby_{dist.Os}").CombineWithFilePath($"{dist.DllPrefix}dobby_{dist.Arch}.{dist.DllExtension}"),
277-
bepInExCoreDir.CombineWithFilePath($"{dist.DllPrefix}dobby.{dist.DllExtension}"));
278-
ctx.CopyDirectory(ctx.CacheDirectory.Combine("dotnet").Combine(dist.RuntimeIdentifier),
279-
targetDir.Combine("dotnet"));
280-
}
281-
}
282-
else if (dist.Engine == "NET")
283-
{
284-
if (dist.Runtime == "Framework")
285-
{
286-
ctx.DeleteFile(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe.config"));
287-
288-
ctx.MoveFileToDirectory(bepInExCoreDir.CombineWithFilePath("BepInEx.NET.Framework.Launcher.exe"), targetDir);
289-
}
290-
else if (dist.Runtime == "CoreCLR")
291-
{
292-
foreach (var filePath in ctx.GetFiles(bepInExCoreDir.Combine("BepInEx.NET.CoreCLR.*").FullPath))
293-
ctx.MoveFileToDirectory(filePath, targetDir);
294-
}
295-
}
296177
}
297178
}
298179
}

0 commit comments

Comments
 (0)