Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imporove release workflow ( installing plugins is now easier than before) #89

Merged
merged 44 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e223c60
verify release work flow
KirisameMarisa Jan 20, 2024
e274017
Update release.yml
KirisameMarisa Jan 20, 2024
916778b
Update release.yml
KirisameMarisa Jan 20, 2024
86c4a22
Update release.yml
KirisameMarisa Jan 20, 2024
d25af8b
Update release.yml
KirisameMarisa Jan 20, 2024
4f7d1fa
Update release.yml
KirisameMarisa Jan 20, 2024
9e16908
fix script, mkdir flatbuffer output directory
KirisameMarisa Jan 20, 2024
a693542
Merge branch 'improve_release_flow' of https://github.com/KirisameMar…
KirisameMarisa Jan 20, 2024
907fc4f
fix script
KirisameMarisa Jan 20, 2024
37ae4a1
Update build_flatbuffers_cpp.py
KirisameMarisa Jan 20, 2024
9b26969
fix script
KirisameMarisa Jan 20, 2024
c396f4e
Merge branch 'improve_release_flow' of https://github.com/KirisameMar…
KirisameMarisa Jan 20, 2024
2d4c177
Update build_flatbuffers_cpp.py
KirisameMarisa Jan 20, 2024
3afa5df
Update build_flatbuffers_cpp.py
KirisameMarisa Jan 20, 2024
312d246
Update build_flatbuffers_cpp.py
KirisameMarisa Jan 20, 2024
d59f808
Update release.yml
KirisameMarisa Jan 20, 2024
3ed5fda
Update build_godot.py
KirisameMarisa Jan 20, 2024
519d34c
add sample unity project
KirisameMarisa Jan 21, 2024
72b8cec
moved file
KirisameMarisa Jan 21, 2024
b704a9e
delete files
KirisameMarisa Jan 21, 2024
77bb2e1
delete file
KirisameMarisa Jan 21, 2024
e54a9f9
update unity plugin
KirisameMarisa Jan 21, 2024
bcc86f9
add asmdef
KirisameMarisa Jan 21, 2024
20d61d5
remove
KirisameMarisa Jan 21, 2024
4270057
add google flatbuffers meta
KirisameMarisa Jan 21, 2024
a50d9cb
update script
KirisameMarisa Jan 21, 2024
dae67eb
Update release.yml
KirisameMarisa Jan 21, 2024
df02afa
Update release.yml
KirisameMarisa Jan 21, 2024
7cd2ce2
Update release.yml
KirisameMarisa Jan 21, 2024
91a3e70
update script
KirisameMarisa Jan 21, 2024
1e18cae
Merge branch 'improve_release_flow' of https://github.com/KirisameMar…
KirisameMarisa Jan 21, 2024
f74d413
Update release.yml
KirisameMarisa Jan 21, 2024
ca7c732
fix pack script
KirisameMarisa Jan 21, 2024
acfa6d4
Merge branch 'improve_release_flow' of https://github.com/KirisameMar…
KirisameMarisa Jan 21, 2024
1519b0e
Update release.yml
KirisameMarisa Jan 21, 2024
7132a64
Update release.yml
KirisameMarisa Jan 21, 2024
1e6e6e9
Update release.yml
KirisameMarisa Jan 21, 2024
4ab5cbb
Update release.yml
KirisameMarisa Jan 21, 2024
06378be
Update release.yml
KirisameMarisa Jan 21, 2024
bcb2d46
Update release.yml
KirisameMarisa Jan 21, 2024
5cc742f
Update release.yml
KirisameMarisa Jan 21, 2024
1d5fc2e
Update release.yml
KirisameMarisa Jan 21, 2024
a5f55d8
Update release.yml
KirisameMarisa Jan 21, 2024
7c2cd12
Update release.yml
KirisameMarisa Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 157 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,127 @@ permissions:
contents: read

jobs:
create_draft_release:
upload-plugin-unity-artifact:
permissions:
contents: write
pull-requests: write

runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- name: Delete drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Create release draft
uses: release-drafter/release-drafter@v5
id: create_draft
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Build flatbuffers
run: python ExternalTools/BuildScripts/build_flatbuffers_csharp.py

- name: Setup unity
uses: game-ci/unity-builder@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: Plugins/Unity/project
buildMethod: GenUnityPackage.Export

- name: Upload Artifact Unity
uses: actions/upload-artifact@v3
with:
name: Artifact-Unity-Plugin
path: Plugins/Unity/Artifact

upload-plugins-artifact:
permissions:
contents: write
pull-requests: write

strategy:
matrix:
runs-on: [windows-latest, macos-latest, ubuntu-latest, ]
runs-on: ${{ matrix.runs-on }}

env:
Builder: 1

steps:
- uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive

- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- run: pip install SCons

- name: Set up .NET Core
if: runner.os == 'Linux'
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x

- name: Install cmake on ubuntu-latest
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y cmake

- name: Install cmake on macos-latest
if: runner.os == 'macOS'
run: |
brew update
brew install cmake

- name: Install cmake on windows-latest
if: runner.os == 'Windows'
run: |
choco install cmake

- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/[email protected]

- name: Build flatbuffers
run: python ExternalTools/BuildScripts/build_flatbuffers.py

- name: Build Godot
run: python ExternalTools/BuildScripts/build_godot.py

- name: Upload Artifact Godot
uses: actions/upload-artifact@v3
with:
name: Artifact-Godot-Plugin
path: Plugins/Godot/project/addons

- name: Upload Artifact UnrealEngine
uses: actions/upload-artifact@v3
with:
name: Artifact-UnrealEngine-Plugin
path: Plugins/UnrealEngine

upload-app-artifact:
permissions:
contents: write
pull-requests: write

runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

Expand All @@ -41,18 +143,48 @@ jobs:
- name: Build C# application
run: dotnet build Application/BocchiTracker.WPF.sln -c Release

- name: Archive application
run: Compress-Archive -Path "Application/WPF/Artifact/Release/net7.0-windows" -DestinationPath "BocchiTracker.zip"
- name: Upload Artifact Application
uses: actions/upload-artifact@v3
with:
name: Artifact-BocchiTracker
path: Application/WPF/Artifact/Release/net7.0-windows

- name: Archive UnrealEngine plugin
run: Compress-Archive -Path "Plugins/UnrealEngine" -DestinationPath "UnrealEngine.zip"
create_draft_release:
needs: [upload-app-artifact, upload-plugins-artifact, upload-plugin-unity-artifact]
permissions:
contents: write
pull-requests: write

- name: Archive Unity plugin
run: Compress-Archive -Path "Plugins/Unity" -DestinationPath "Unity.zip"
runs-on: ubuntu-latest

steps:
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
path: Artifacts
pattern: Artifact-*
merge-multiple: true

- name: Delete drafts
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release draft
uses: release-drafter/release-drafter@v5
id: create_draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Archive Application
run: zip -r BocchiTracker.zip ./Artifacts/Artifact-BocchiTracker

- name: Archive UnrealEngine plugin
run: zip -r UnrealEngine.zip ./Artifacts/Artifact-UnrealEngine-Plugin

- name: Archive Godot plugin
run: Compress-Archive -Path "Plugins/Godot" -DestinationPath "Godot.zip"

run: zip -r Godot.zip ./Artifacts/Artifact-Godot-Plugin
- name: Upload Application
uses: actions/upload-release-asset@v1
env:
Expand All @@ -61,7 +193,7 @@ jobs:
upload_url: ${{ steps.create_draft.outputs.upload_url }}
asset_path: ./BocchiTracker.zip
asset_name: BocchiTracker.zip
asset_content_type: application/zip
asset_content_type: application/zip

- name: Upload UnrealEngine plugin
uses: actions/upload-release-asset@v1
Expand All @@ -73,22 +205,22 @@ jobs:
asset_name: UnrealEngine.zip
asset_content_type: application/zip

- name: Upload Unity plugin
- name: Upload Godot plugin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_draft.outputs.upload_url }}
asset_path: ./Unity.zip
asset_name: Unity.zip
asset_path: ./Godot.zip
asset_name: Godot.zip
asset_content_type: application/zip

- name: Upload Godot plugin
- name: Upload Unity plugin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_draft.outputs.upload_url }}
asset_path: ./Godot.zip
asset_name: Godot.zip
asset_path: ./Artifacts/Artifact-Unity-Plugin/BocchiTracker.unitypackage
asset_name: BocchiTracker.unitypackage
asset_content_type: application/zip
33 changes: 30 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,40 @@ Artifact/
*.obj
*.yaml
*.dblite
*.unityproj
launchSettings.json

Plugins/UnrealEngine/BocchiTracker/Content
Plugins/UnrealEngine/BocchiTracker/Binaries
Plugins/UnrealEngine/BocchiTracker/Intermediate
Plugins/UnrealEngine/ThirdParty/flatbuffers/include
Plugins/UnrealEngine/ThirdParty/flatbuffers/lib
UnityEditor.dll
UnityEngine.dll
Google.FlatBuffers.*
Google.FlatBuffers.*

### Unity ###
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
Plugins/Unity/project/[Ll]ibrary/
Plugins/Unity/project/[Tt]emp/
Plugins/Unity/project/[Oo]bj/
Plugins/Unity/project/[Bb]uild/
Plugins/Unity/project/[Bb]uilds/
Plugins/Unity/project/[Ll]ogs/
Plugins/Unity/project/[Uu]ser[Ss]ettings/
Plugins/Unity/project/*sln
Plugins/Unity/project/*csproj


*.pidb.meta
*.pdb.meta

sysinfo.txt

# Builds
*.apk
*.unitypackage

# Autogenerated files
InitTestScene*.unity.meta
InitTestScene*.unity
22 changes: 10 additions & 12 deletions ExternalTools/BuildScripts/build_flatbuffers_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,25 @@ def Build():
unreal_engine_include_path = config.cUnrealEnginePath / "ThirdParty" / "flatbuffers" / "include"
shutil.copytree(include_path, unreal_engine_include_path.resolve(), dirs_exist_ok=True)

release_lib_path = config.cFlatBuffersPath / "Release"
if platform.system() == "Windows":
release_lib_path = config.cFlatBuffersPath / "Release" / "flatbuffers.lib"
unreal_engine_lib_path = config.cUnrealEnginePath / "ThirdParty" / "flatbuffers" / "lib" / "Win64" / "Release"
else:
release_lib_path = config.cFlatBuffersPath / "libflatbuffers.a"
unreal_engine_lib_path = config.cUnrealEnginePath / "ThirdParty" / "flatbuffers" / "lib" / "Unix" / "Release"
shutil.copytree(release_lib_path.resolve(), unreal_engine_lib_path.resolve(), dirs_exist_ok=True)

def RunMsBuild():
msbuild_path = Path("C:\\") / "Program Files" / "Microsoft Visual Studio" / "2022" / "Community" / "Msbuild" / "Current" / "Bin" / "MSBuild.exe"
if not msbuild_path.exists():
print("not exist MSBuild.exe, should install VisualStudio build tools.")
return
unreal_engine_lib_path.resolve().mkdir(exist_ok=True, parents=True)
shutil.copy(release_lib_path.resolve(), unreal_engine_lib_path.resolve())

def RunMsBuild():
subprocess.call(["cmake", "-G", "Visual Studio 17", "-DCMAKE_BUILD_TYPE=Release"], cwd=config.cFlatBuffersPath)
subprocess.call([msbuild_path, config.cFlatBuffersPath / "FlatBuffers.sln", "-t:flatbuffers", "/p:Configuration=Release"])
subprocess.call([msbuild_path, config.cFlatBuffersPath / "FlatBuffers.sln", "-t:flatc", "/p:Configuration=Release"])
subprocess.call(["msbuild", "FlatBuffers.sln", "-t:flatbuffers", "/p:Configuration=Release"], cwd=config.cFlatBuffersPath)
subprocess.call(["msbuild", "FlatBuffers.sln", "-t:flatc", "/p:Configuration=Release"], cwd=config.cFlatBuffersPath)

def RunUnix():
subprocess.call(["cmake", "-G", "Unix Makefiles", "-DCMAKE_BUILD_TYPE=Release"])
subprocess.call(["make", "-j"])
subprocess.call(["cmake", "-G", "Unix Makefiles", "-DCMAKE_BUILD_TYPE=Release"], cwd=config.cFlatBuffersPath)
subprocess.call(["make", "-j"], cwd=config.cFlatBuffersPath)


if __name__ == '__main__':
Build()
Build()
12 changes: 3 additions & 9 deletions ExternalTools/BuildScripts/build_flatbuffers_csharp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@
import config

def Build():
print("Cmake C# flatbuffers")
subprocess.call(["cmake", "-G", "Visual Studio 17", "-DCMAKE_BUILD_TYPE=Release", "ExternalTools\\flatbuffers"])

print("Build C# flatbuffers")
dotnet_path = "dotnet"
flatbuffers_csproj_path = config.cFlatBuffersPath / "net" / "FlatBuffers" / "Google.FlatBuffers.csproj"
subprocess.call([dotnet_path, "build", flatbuffers_csproj_path.resolve(), "-c", "Release"])
subprocess.call(["dotnet", "build", flatbuffers_csproj_path.resolve(), "-c", "Release"], cwd=config.cFlatBuffersPath)

print("Copying flatbuffers to Unity directory...")
artifact = config.cFlatBuffersPath / "net" / "FlatBuffers" / "bin" / "Release" / "netstandard2.1"
unity_thirdparty_path = config.cUnityPath / "ThirdParty" / "flatbuffers"
unity_plugin_artifact_path = config.cUnityPath / "Artifact"
shutil.copytree(artifact, unity_thirdparty_path.resolve(), dirs_exist_ok=True)
shutil.copytree(artifact, unity_plugin_artifact_path.resolve(), dirs_exist_ok=True)
unity_external_packages_path = config.cUnityPath / "project" / "Assets" / "BocchiTracker" / "ExternalPackages" / "flatbuffers"
shutil.copytree(artifact, unity_external_packages_path.resolve(), dirs_exist_ok=True)

if __name__ == '__main__':
Build()
8 changes: 8 additions & 0 deletions ExternalTools/BuildScripts/build_godot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import subprocess
import config

def Build():
subprocess.call(["python", "-m", "SCons"], cwd=config.cGodotPath)

if __name__ == '__main__':
Build()
9 changes: 5 additions & 4 deletions ExternalTools/BuildScripts/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path

cFlatBuffersPath = Path("ExternalTools") / "flatbuffers"
cPluginsPath = "Plugins/"
cUnrealEnginePath = Path(cPluginsPath) / "UnrealEngine"
cUnityPath = Path(cPluginsPath) / "Unity"
cFlatBuffersPath = Path("ExternalTools") / "flatbuffers"
cPluginsPath = "Plugins/"
cUnrealEnginePath = Path(cPluginsPath) / "UnrealEngine"
cUnityPath = Path(cPluginsPath) / "Unity"
cGodotPath = Path(cPluginsPath) / "Godot"
2 changes: 1 addition & 1 deletion ExternalTools/flatbuffers
Submodule flatbuffers updated 220 files
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Plugins/Unity/Artifact/BocchiTracker.dll
Binary file not shown.
Empty file.
29 changes: 0 additions & 29 deletions Plugins/Unity/BocchiTracker/BocchiTracker.csproj

This file was deleted.

Loading
Loading