Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build-package-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ jobs:
BOT_PRIVATE_KEY: ${{ secrets.BOT_PRIVATE_KEY }}
with:
ref: ${{ github.ref }}
file-path: ./Assets/Plugins/PackageExporter/package.json
file-path: ./Assets/PackageExporter/package.json
tag: ${{ inputs.tag }}
dry-run: ${{ inputs.dry-run }}
require-validation: false
commit-message-format: 'Update the Package Exporter package.json to {v}'

build-package:
needs: [verify-branch, get-latest-release, check-existing-package, update-packagejson]
Expand Down
3 changes: 2 additions & 1 deletion Assets/Editor/PackageExporterSetting.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: adb346ada09d4f62892e782d664fc210, type: 3}
m_Name: PackageExporterSetting
m_EditorClassIdentifier:
_folderPath: Assets/Plugins/PackageExporter/
_folderPath: Assets/PackageExporter/
_isCompletedTest: 1
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ internal sealed class Builder
public static void Build()
{
var assetsFolderPath = PackageExporterSetting.Instance.FolderPath;
if (!string.IsNullOrWhiteSpace(assetsFolderPath))
var isCompletedTest = PackageExporterSetting.Instance.IsCompletedTest;
if (!string.IsNullOrWhiteSpace(assetsFolderPath) && isCompletedTest)
{
var options = ArgumentsParser.GetValidatedOptions();
var buildPath = options.GetValueOrDefault("customBuildPath");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,29 @@ internal sealed class PackageExporterSetting : ScriptableObject
public const string AssetPath = "Assets/Editor/PackageExporterSetting.asset";

[SerializeField] string _folderPath;

public string FolderPath => _folderPath;
[SerializeField] bool _isCompletedTest;

public string FolderPath
{
get => _folderPath;
set
{
_folderPath = value;
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssetIfDirty(this);
}
}

public bool IsCompletedTest
{
get => _isCompletedTest;
set
{
_isCompletedTest = value;
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssetIfDirty(this);
}
}

public static PackageExporterSetting Instance
{
Expand All @@ -24,12 +45,5 @@ public static PackageExporterSetting Instance
}
}
static PackageExporterSetting s_instance;

public void SetFolderPath(string path)
{
_folderPath = path;
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssetIfDirty(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace PackageExporter.Editor
{
internal class PackageExporterWindow : EditorWindow
{
const string _buildPath = "PackageExportTest.unitypackage";

[MenuItem("Window/Test Export Package")]
public static void ShowWindow()
{
Expand Down Expand Up @@ -48,9 +50,13 @@ void OnGUI()

if (buttonClicked)
{
_assetsFolderPath = AssetDatabase.IsValidFolder(_assetsFolderPath)
? _assetsFolderPath
: string.Empty;

var selectedPath = EditorUtility.OpenFolderPanel(
"Select assets folder",
string.IsNullOrEmpty(_assetsFolderPath)
string.IsNullOrWhiteSpace(_assetsFolderPath)
? "Assets/"
: _assetsFolderPath,
"Select assets folder");
Expand All @@ -77,7 +83,7 @@ void OnGUI()
Debug.LogError("Please select the directory path under Assets.");
}

PackageExporterSetting.Instance.SetFolderPath(_assetsFolderPath);
PackageExporterSetting.Instance.FolderPath = _assetsFolderPath;
EditorUtility.SetDirty(this);
}
}
Expand All @@ -87,7 +93,8 @@ void OnGUI()
if (GUILayout.Button("Export Package", GUILayout.Height(35))
&& ValidDirectory(_assetsFolderPath))
{
Builder.Build(_assetsFolderPath, "Test.unitypackage");
Builder.Build(_assetsFolderPath, _buildPath);
PackageExporterSetting.Instance.IsCompletedTest = File.Exists(_buildPath);
}
}

Expand Down
3 changes: 0 additions & 3 deletions Assets/Plugins.meta

This file was deleted.

Loading