diff --git a/.github/workflows/ksp-publish.yml b/.github/workflows/ksp-publish.yml
new file mode 100644
index 0000000..dd245c4
--- /dev/null
+++ b/.github/workflows/ksp-publish.yml
@@ -0,0 +1,119 @@
+name: Build and Release
+on:
+ push:
+ pull_request:
+ types:
+ - opened
+ - edited
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Setup Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+
+ - name: Setup .NET Core SDK
+ uses: actions/setup-dotnet@v1.7.2
+ with:
+ dotnet-version: '6.0.x'
+
+ - name: Install Python Tools
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install -r Tools/requirements.txt
+
+ - name: Download Dependencies
+ run: |
+ mkdir -p DepthMask/dlls
+ mkdir -p GameData
+ wget --user drewcassidy --password ${{ secrets.PILE_OF_ROCKS_PASS }} https://pileof.rocks/Secret/KSP-1.12.3-dlls.zip
+ unzip KSP-*-dlls.zip -d DepthMask/
+
+ - name: Generate Version Info
+ run: |
+ python Tools/version.py
+
+ - name: Validate Version Info
+ uses: DasSkelett/AVC-VersionFileValidator@master
+ with:
+ only: '["./GameData/DepthMask/DepthMask.version"]'
+
+ - name: Build DLL
+ run: |
+ dotnet build --configuration Release DepthMask.sln
+
+ - name: Upload Build
+ uses: actions/upload-artifact@v3
+ with:
+ name: DepthMask
+ path: |
+ GameData/DepthMask
+ README.md
+ CHANGELOG.md
+ LICENSE.md
+
+
+ deploy:
+ needs: build
+ runs-on: ubuntu-latest
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: '3.x'
+
+ - name: Install Python Tools
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install yaclog
+
+ - name: Setup SSH keys
+ uses: kielabokkie/ssh-key-and-known-hosts-action@v1
+ with:
+ ssh-private-key: ${{ secrets.PILE_OF_ROCKS_PRIVATE_KEY }}
+ ssh-host: pileof.rocks
+
+ - name: Get version name and body
+ run: |
+ echo "VERSION_TITLE=$(yaclog show -n)" >> $GITHUB_ENV
+ echo "$(yaclog show -mb)" >> RELEASE.md
+
+ - name: Download Build Artifacts
+ uses: actions/download-artifact@v3
+
+ - name: Zip Download Packages
+ run: |
+ mkdir deploy
+
+ zip -r deploy/DepthMask-$GITHUB_REF.zip DepthMask/*
+ cp DepthMask/GameData/DepthMask/DepthMask.version deploy/
+
+ ls deploy
+
+ - name: Publish to Github
+ uses: softprops/action-gh-release@v1
+ with:
+ files: |
+ deploy/Shabby-*.zip
+ deploy/DepthMask.version
+ name: DepthMask Version ${{ env.GITHUB_REF }}
+ body_path: RELEASE.md
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Publish to Server
+ run: |
+ rsync -t deploy/* drewcassidy@pileof.rocks:/var/www/pileof.rocks/html/KSP/
+
\ No newline at end of file
diff --git a/DepthMask/DepthMask.csproj b/DepthMask/DepthMask.csproj
index a99d636..87994ee 100644
--- a/DepthMask/DepthMask.csproj
+++ b/DepthMask/DepthMask.csproj
@@ -5,7 +5,7 @@
false
x64
1701;1702;CS0649;CS1591
- 1.1.2
+ false
@@ -36,7 +36,8 @@
-
+
+
diff --git a/Templates/DepthMask/Properties/AssemblyInfo.cs b/Templates/DepthMask/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..b6f8d8e
--- /dev/null
+++ b/Templates/DepthMask/Properties/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+using System.Reflection;
+
+// KSP assembly information
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+[assembly: AssemblyVersionAttribute("{{ ver_major }}.{{ ver_minor }}.{{ ver_patch }}")]
+[assembly: AssemblyInformationalVersionAttribute("{{ ver_major }}.{{ ver_minor }}.{{ ver_patch }}")]
+[assembly: KSPAssembly("DepthMask", {{ ver_major }}, {{ ver_minor }}, {{ ver_patch }})]
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+[assembly: AssemblyCopyright("2022 Andrew Cassidy")]
\ No newline at end of file
diff --git a/Templates/GameData/DepthMask/DepthMask.version b/Templates/GameData/DepthMask/DepthMask.version
new file mode 100644
index 0000000..81f9c26
--- /dev/null
+++ b/Templates/GameData/DepthMask/DepthMask.version
@@ -0,0 +1,20 @@
+{
+ "NAME":"DepthMask",
+ "URL":"https://github.com/drewcassidy/KSP-DepthMask/releases/latest/download/DepthMask.version",
+ "DOWNLOAD":"https://github.com/drewcassidy/KSP-DepthMask/releases/latest",
+ "CHANGE_LOG_URL":"https://github.com/drewcassidy/KSP-DepthMask/blob/master/CHANGELOG.md"
+ "VERSION": {
+ "MAJOR": {{ ver_major }},
+ "MINOR": {{ ver_minor }},
+ "PATCH": {{ ver_patch }},
+ "BUILD": {{ ver_build }}
+ },
+ "KSP_VERSION_MIN": {
+ "MAJOR":1,
+ "MINOR":11
+ },
+ "KSP_VERSION_MAX": {
+ "MAJOR":1,
+ "MINOR":12
+ }
+}
diff --git a/Tools/requirements.txt b/Tools/requirements.txt
new file mode 100644
index 0000000..8007af9
--- /dev/null
+++ b/Tools/requirements.txt
@@ -0,0 +1,3 @@
+GitPython ~= 3.1.27
+yaclog ~= 1.0.4
+jinja2 ~= 3.1.0
\ No newline at end of file
diff --git a/Tools/version.py b/Tools/version.py
new file mode 100644
index 0000000..a4f0f12
--- /dev/null
+++ b/Tools/version.py
@@ -0,0 +1,55 @@
+# This file generates versioned files for deploying DepthMask
+
+import yaclog
+import yaclog.version
+import git as gp
+import os
+from pathlib import Path
+from jinja2 import Environment, FileSystemLoader, select_autoescape
+
+
+def run():
+ basedir = Path(__file__).parent.parent
+
+ g = gp.Git(basedir)
+
+ release = True
+ tag, distance, sha = g.execute(["git", "describe"]).split("-")
+
+ if int(distance) > 0:
+ release = False
+ tag = yaclog.version.increment_version(tag, 2)
+
+ segments = tag.split('.')
+ ver_major, ver_minor, ver_patch = segments[0:3]
+ if len(segments) >= 4:
+ ver_build = segments[3]
+ elif release:
+ ver_build = int(distance)
+ else:
+ ver_build = int("0x" + sha[1:5], 16)
+
+ print(f'Configuring version {ver_major}.{ver_minor}.{ver_patch} build {ver_build}')
+
+ env = Environment(
+ loader=FileSystemLoader(basedir / "Templates"),
+ autoescape=select_autoescape()
+ )
+
+ for template_name in ["GameData/DepthMask/DepthMask.version", "DepthMask/Properties/AssemblyInfo.cs"]:
+ print("Generating " + template_name)
+ template = env.get_template(template_name)
+ with open(basedir / template_name, "w") as fh:
+ fh.write(template.render(
+ ver_major=ver_major,
+ ver_minor=ver_minor,
+ ver_patch=ver_patch,
+ ver_build=ver_build,
+ tag=tag
+ ))
+
+ print('Done!')
+
+
+if __name__ == '__main__':
+ run()