generated from ayutaz/unity_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ayutaz/develop
v0.1
- Loading branch information
Showing
45 changed files
with
171,643 additions
and
377 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Crete Pre-Release Page | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
projectPath: | ||
- . | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Cache | ||
uses: actions/cache@v3.3.2 | ||
with: | ||
path: Library | ||
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | ||
restore-keys: | | ||
Library- | ||
- name: Release | ||
uses: softprops/action-gh-release@v0.1.15 | ||
with: | ||
draft: true | ||
generate_release_notes: true | ||
name: ${{ github.event.pull_request.body }} | ||
tag_name: ${{ github.event.pull_request.title }} | ||
prerelease: false | ||
files: | | ||
build/${{ env.FILE_NAME }}.unitypackage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,77 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public static class PackageExporter | ||
{ | ||
private const string RootDirectory = "Assets/UniRealtime/Scripts"; | ||
private const string FileName = "UniRealtime"; | ||
|
||
/// <summary> | ||
/// パッケージの書き出し(エディタ上でのテスト用) | ||
/// メニュー 「Tools > Export Unitypackage」をクリックで実行 | ||
/// </summary> | ||
[MenuItem("Tools/Export Unitypackage")] | ||
public static void ExportTestOnEditor() | ||
{ | ||
var exportPath = EditorUtility.SaveFilePanel | ||
( | ||
"保存先を選択", | ||
Application.dataPath, | ||
$"{FileName}.unitypackage", | ||
"unitypackage" | ||
); | ||
|
||
CreatePackage(RootDirectory, exportPath); | ||
} | ||
|
||
/// <summary> | ||
/// パッケージの書き出し | ||
/// GitHub Actionsから呼ばれる | ||
/// </summary> | ||
public static void Export() | ||
{ | ||
CreatePackage(RootDirectory, $"build/{FileName}.unitypackage"); | ||
} | ||
|
||
/// <summary> | ||
/// パッケージの書き出し | ||
/// </summary> | ||
/// <param name="rootDirectory"></param> | ||
/// <param name="exportPath"></param> | ||
private static void CreatePackage(string rootDirectory, string exportPath) | ||
{ | ||
SafeCreateDirectory(exportPath); | ||
var assetsPaths = GetAllAssetsAtPath(rootDirectory); | ||
AssetDatabase.ExportPackage(assetsPaths, exportPath, ExportPackageOptions.Default); | ||
Debug.Log( | ||
$"Export complete: {Path.GetFullPath(exportPath)}\nExport below files:\n{string.Join("\n", assetsPaths)}"); | ||
} | ||
|
||
/// <summary> | ||
/// ディレクトリが存在しない場合にディレクトリを作成する | ||
/// </summary> | ||
/// <param name="path"></param> | ||
/// <returns></returns> | ||
private static DirectoryInfo SafeCreateDirectory(string path) | ||
{ | ||
var diParent = Directory.GetParent(path); | ||
if (diParent == null || Directory.Exists(diParent.FullName)) return null; | ||
return Directory.CreateDirectory(diParent.FullName); | ||
} | ||
|
||
/// <summary> | ||
/// 指定したパス以下の全てのファイルパスを取得する | ||
/// </summary> | ||
/// <param name="root"></param> | ||
/// <returns></returns> | ||
private static string[] GetAllAssetsAtPath(string root) | ||
{ | ||
return Directory.GetFiles(root, "*", SearchOption.AllDirectories) | ||
.Where(x => !string.IsNullOrEmpty(x)) | ||
.Where(x => !x.EndsWith(".meta")) | ||
.Where(x => x != ".DS_Store") | ||
.ToArray(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.