-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update project structure and add non-windows builds for 1432 and 1221
- Loading branch information
Showing
12 changed files
with
674 additions
and
61 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,122 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Hollow Knight version | ||
required: true | ||
type: string | ||
workflow_call: | ||
inputs: | ||
version: | ||
description: Hollow Knight version | ||
required: true | ||
type: string | ||
secrets: | ||
BINARY_ARCHIVE_DEPLOY_KEY: | ||
required: true | ||
|
||
jobs: | ||
create-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version-list: ${{ steps.procver.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Process Versions | ||
id: procver | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const script = require("./.github/workflows/create_matrix.js"); | ||
return await script({ context }); | ||
build: | ||
needs: [create-matrix] | ||
strategy: | ||
matrix: | ||
platform: [windows, macos, linux] | ||
ref: [main] | ||
hk: ${{ fromJson(needs.create-matrix.outputs.version-list) }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Checkout Binaries | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: hk-modding/hk-binary-archives | ||
ref: ${{ matrix.ref }} | ||
ref: main | ||
ssh-key: ${{ secrets.BINARY_ARCHIVE_DEPLOY_KEY }} | ||
sparse-checkout: | | ||
${{ inputs.version }}/managed.${{ matrix.platform }}.tar.gz | ||
${{ matrix.hk.version }}/managed.${{ matrix.platform }}.tar.gz | ||
sparse-checkout-cone-mode: false | ||
path: ./hk-binary-archives | ||
|
||
- name: Unpack Archive | ||
run: | | ||
mkdir vanilla-15 | ||
cd ./vanilla-15 | ||
tar -xzf ../hk-binary-archives/${{ inputs.version }}/managed.${{ matrix.platform }}.tar.gz | ||
mkdir vanilla-${{ matrix.hk.branch}} | ||
cd ./vanilla-${{ matrix.hk.branch}} | ||
tar -xzf ../hk-binary-archives/${{ matrix.hk.version }}/managed.${{ matrix.platform }}.tar.gz | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
|
||
with: | ||
dotnet-version: 6.0.x | ||
- name: Setup MSBuild | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y nuget mono-devel mono-xbuild | ||
- name: Build | ||
run: | | ||
dotnet restore | ||
dotnet build | ||
dotnet restore ${{ matrix.hk.branch}} | ||
dotnet build ${{ matrix.hk.branch}} | ||
- name: Upload Binary | ||
if: ( startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' ) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build.${{ inputs.version }}.${{ matrix.platform }} | ||
path: ./out-15/ | ||
name: build.${{ matrix.hk.version }}.${{ matrix.platform }} | ||
path: ./out-${{ matrix.hk.branch}}/ | ||
|
||
release: | ||
needs: [build] | ||
if: startsWith(github.ref, 'refs/tags') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Read Versions | ||
# what the fuck lol | ||
# parses a tag of the form v<MS VERSION>-hk<HK VERSION> | ||
run: | | ||
echo "${{ github.ref_name }}" | sed -E "s/v(.*?)\-hk(.*)/MS_VER=\1\nHK_VER=\2/" >> $GITHUB_ENV | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ./artifacts | ||
- name: Zip Artifacts | ||
run: | | ||
zip -jr minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.windows.zip \ | ||
./artifacts/build.${{ env.HK_VER }}.windows/* | ||
zip -jr minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.macos.zip \ | ||
./artifacts/build.${{ env.HK_VER }}.macos/* | ||
zip -jr minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.linux.zip \ | ||
./artifacts/build.${{ env.HK_VER }}.linux/* | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
- name: Install Node Dependencies | ||
run: | | ||
npm install handlebars | ||
- name: Create Release Notes | ||
id: create-relnotes | ||
uses: actions/github-script@v7 | ||
env: | ||
HK_VERSION: ${{ env.HK_VER }} | ||
MS_VERSION: ${{ env.MS_VER }} | ||
with: | ||
result-encoding: string | ||
script: | | ||
const script = require("./.github/workflows/create_relnotes.js"); | ||
return await script(); | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body: ${{ steps.create-relnotes.outputs.result }} | ||
files: | | ||
./minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.windows.zip | ||
./minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.macos.zip | ||
./minisavestates.v${{ env.MS_VER }}-hk${{ env.HK_VER }}.linux.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const tag_regex = /v(.*?)\-hk(.*)/; | ||
const tag_prefix = "refs/tags/"; | ||
|
||
// @ts-check | ||
/** @param {import("github-script").AsyncFunctionArguments} AsyncFunctionArguments */ | ||
module.exports = async ({ context }) => { | ||
const fs = require("node:fs/promises"); | ||
|
||
const versions = JSON.parse(await fs.readFile("./versions.json", { encoding: "utf-8" })); | ||
|
||
// if the ref is a tag, limit the versions built to only the relevant version. | ||
if(context.ref.startsWith(tag_prefix)) { | ||
const tag_name = context.ref.slice(tag_prefix.length); | ||
const tag_hk_version = tag_regex.exec(tag_name)[2].trim(); | ||
return versions.filter(x => x.version === tag_hk_version); | ||
} else { | ||
return versions; | ||
} | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net35</TargetFramework> | ||
<AssemblyName>Assembly-CSharp.mm</AssemblyName> | ||
<LangVersion>latest</LangVersion> | ||
<Branch>12xx</Branch> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MonoMod" Version="21.4.29.1"> | ||
<IncludeAssets>all</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>../vanilla-$(Branch)/Assembly-CSharp.dll</HintPath> | ||
<SpecificVersion>False</SpecificVersion> | ||
</Reference> | ||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>../vanilla-$(Branch)/UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="PlayMaker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>../vanilla-$(Branch)/PlayMaker.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<Mono Condition="$(OS) == WINDOWS_NT" /> | ||
<Mono Condition="$(OS) != WINDOWS_NT">mono</Mono> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Files Include="$(ProjectDir)../vanilla-$(Branch)/*" /> | ||
<BuildDir Include="$(TargetDir)" /> | ||
</ItemGroup> | ||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Copy SkipUnchangedFiles="true" SourceFiles="@(Files)" DestinationFolder="@(BuildDir)" /> | ||
<Delete Condition="Exists('MONOMODDED_Assembly-CSharp.dll')" Files="MONOMODDED_Assembly-CSharp.dll" /> | ||
<Exec WorkingDirectory="@(BuildDir)" Command="$(Mono) MonoMod.exe Assembly-CSharp.dll" /> | ||
<Copy SourceFiles="$(TargetDir)/MONOMODDED_Assembly-CSharp.dll" DestinationFiles="$(ProjectDir)../out-$(Branch)/Assembly-CSharp.dll" /> | ||
</Target> | ||
</Project> |
Oops, something went wrong.