Skip to content

Commit de792e8

Browse files
authored
Merge pull request #83 from IShix-g/release
feat: enhance path normalization and package export
2 parents c73b035 + f0f7549 commit de792e8

File tree

3 files changed

+30
-35
lines changed

3 files changed

+30
-35
lines changed

.github/workflows/reusable-build-package.yaml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ jobs:
5959
echo "::notice title=Unity Version::$unity_version"
6060
6161
build-package:
62-
name: Build for StandaloneLinux64
6362
timeout-minutes: 20
6463
runs-on: ubuntu-22.04
6564
steps:
@@ -75,45 +74,49 @@ jobs:
7574
key: Library-StandaloneLinux64
7675
restore-keys: Library-
7776

78-
- uses: game-ci/unity-builder@v4
79-
env:
80-
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
81-
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
82-
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
83-
with:
84-
targetPlatform: StandaloneLinux64
85-
buildName: ${{ inputs.package-name }}_${{ inputs.tag }}.unitypackage
86-
unityVersion: ${{ inputs.unity-version }}
87-
projectPath: ${{ inputs.project-path }}
88-
buildsPath: ${{ inputs.builds-path }}
89-
buildMethod: ${{ inputs.build-method }}
90-
customParameters: -tag ${{ inputs.tag }} ${{ inputs.custom-parameters }}
91-
9277
- name: Normalize Path
9378
id: path-normalizer
79+
shell: bash
9480
run: |
95-
project_path="${{ inputs.project-path }}"
81+
project_path="${{ inputs.project-path || GITHUB_WORKSPACE }}"
9682
builds_path="${{ inputs.builds-path }}"
97-
package_name="${{ inputs.package-name }}"
98-
tag="${{ inputs.tag }}"
83+
package_name="${{ inputs.package-name }}_${{ inputs.tag }}.unitypackage"
9984
85+
builds_path="${builds_path#/}"
10086
builds_path="${builds_path%/}"
87+
project_path="${project_path#/}"
10188
project_path="${project_path%/}"
89+
builds_path="${builds_path#/}"
10290
builds_path="${builds_path%/}"
10391
10492
if [ -z "$project_path" ]; then
105-
final_path="./$builds_path/StandaloneLinux64/${package_name}_${tag}.unitypackage"
93+
final_path="./$builds_path/StandaloneLinux64/$package_name"
10694
else
107-
final_path="./$project_path/$builds_path/StandaloneLinux64/${package_name}_${tag}.unitypackage"
95+
final_path="./$project_path/$builds_path/StandaloneLinux64/$package_name"
10896
fi
10997
110-
normalized_path=$(echo "$final_path" | sed 's://*:/:g')
98+
export_path=$(echo "$final_path" | sed 's://*:/:g')
11199
112-
echo "path=$normalized_path" >> "$GITHUB_OUTPUT"
113-
echo "::notice title=Export Path:: $normalized_path"
114-
shell: bash
100+
echo "normalized-package-name=$package_name" >> "$GITHUB_OUTPUT"
101+
echo "export-path=$export_path" >> "$GITHUB_OUTPUT"
102+
echo "normalized-project-path=$project_path" >> "$GITHUB_OUTPUT"
103+
echo "::notice title=Export Path:: $export_path"
104+
105+
- uses: game-ci/unity-builder@v4
106+
env:
107+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
108+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
109+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
110+
with:
111+
targetPlatform: StandaloneLinux64
112+
unityVersion: ${{ inputs.unity-version }}
113+
projectPath: ${{ steps.path-normalizer.outputs.normalized-project-path }}
114+
buildsPath: ${{ inputs.builds-path }}
115+
buildName: ${{ steps.path-normalizer.outputs.normalized-package-name }}
116+
buildMethod: ${{ inputs.build-method }}
117+
customParameters: ${{ inputs.custom-parameters }}
115118

116119
- uses: actions/upload-artifact@v4
117120
with:
118121
name: Build-StandaloneLinux64
119-
path: ${{ steps.path-normalizer.outputs.path }}
122+
path: ${{ steps.path-normalizer.outputs.export-path }}

Assets/Editor/ArgumentsParser.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ public static Dictionary<string, string> GetValidatedOptions()
1616
{
1717
Dictionary<string, string> validatedOptions;
1818
ParseCommandLineArguments(out validatedOptions);
19-
20-
if (!validatedOptions.TryGetValue("tag", out var tag))
21-
{
22-
PrintErrorLog("Please pass a tag to customParameters. customParameters: -tag 1.0.0");
23-
}
24-
2519
return validatedOptions;
2620
}
2721

Assets/Editor/PackageExporter.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ public sealed class PackageExporter
1717
public static void Export()
1818
{
1919
var options = ArgumentsParser.GetValidatedOptions();
20-
var buildPath = options.GetValueOrDefault("customBuildPath")?.TrimEnd('/');
21-
var buildName = options.GetValueOrDefault("buildName");
22-
var exportPath = (!string.IsNullOrEmpty(buildPath) ? buildPath + "/" : "") + buildName;
23-
Export(_folderPath, exportPath);
20+
var buildPath = options.GetValueOrDefault("customBuildPath");
21+
Export(_folderPath, buildPath);
2422
}
2523

2624
public static void Export(string folderPath, string exportPath)

0 commit comments

Comments
 (0)