mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-01-29 03:59:08 +08:00
V3 Updates (#529)
- Add missing unityLicenseServer input (Fix #480) - Use HEAD when calculating semantic version number. This is a riskier change as this has always used `github.sha` on the runner. However, when pulling in other repos and running the action, it may not be referencing the correct commit on the repo. After testing, though, nothing appears to be broken so this in theory should work fine. (Fix #417) - Setup private token rewrites on Windows images (Fix #428) - Allow setting a custom workspace path within docker container with `dockerWorkspacePath`. (Fix #433) - [Breaking Change] Remove `androidAppBundle` parameter in favor of `androidExportType`.
This commit is contained in:
46
dist/index.js
generated
vendored
46
dist/index.js
generated
vendored
@@ -308,6 +308,7 @@ class BuildParameters {
|
||||
skipCache: cloud_runner_options_1.default.skipCache,
|
||||
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: input_1.default.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||
};
|
||||
}
|
||||
static parseBuildFile(filename, platform, androidExportType) {
|
||||
@@ -5795,7 +5796,7 @@ class Docker {
|
||||
}
|
||||
}
|
||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
||||
if (!node_fs_1.existsSync(githubHome))
|
||||
node_fs_1.mkdirSync(githubHome);
|
||||
@@ -5804,16 +5805,16 @@ class Docker {
|
||||
node_fs_1.mkdirSync(githubWorkflow);
|
||||
const commandPrefix = image === `alpine` ? `/bin/sh` : `/bin/bash`;
|
||||
return `docker run \
|
||||
--workdir /github/workspace \
|
||||
--workdir ${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters, additionalVariables)} \
|
||||
--env UNITY_SERIAL \
|
||||
--env GITHUB_WORKSPACE=/github/workspace \
|
||||
--env GITHUB_WORKSPACE=${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
|
||||
--volume "${githubHome}":"/root:z" \
|
||||
--volume "${githubWorkflow}":"/github/workflow:z" \
|
||||
--volume "${workspace}":"/github/workspace:z" \
|
||||
--volume "${workspace}":"${dockerWorkspacePath}:z" \
|
||||
--volume "${actionFolder}/default-build-script:/UnityBuilderAction:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/steps:/steps:z" \
|
||||
--volume "${actionFolder}/platforms/ubuntu/entrypoint.sh:/entrypoint.sh:z" \
|
||||
@@ -5826,15 +5827,15 @@ class Docker {
|
||||
"${overrideCommands !== '' ? overrideCommands : `/entrypoint.sh`}"`;
|
||||
}
|
||||
static getWindowsCommand(image, parameters) {
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken } = parameters;
|
||||
const { workspace, actionFolder, unitySerial, gitPrivateToken, dockerWorkspacePath } = parameters;
|
||||
return `docker run \
|
||||
--workdir c:/github/workspace \
|
||||
--workdir c:${dockerWorkspacePath} \
|
||||
--rm \
|
||||
${image_environment_factory_1.default.getEnvVarString(parameters)} \
|
||||
--env UNITY_SERIAL="${unitySerial}" \
|
||||
--env GITHUB_WORKSPACE=c:/github/workspace \
|
||||
--env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \
|
||||
${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \
|
||||
--volume "${workspace}":"c:/github/workspace" \
|
||||
--volume "${workspace}":"c:${dockerWorkspacePath}" \
|
||||
--volume "c:/regkeys":"c:/regkeys" \
|
||||
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
|
||||
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
|
||||
@@ -6738,21 +6739,8 @@ class Input {
|
||||
static get androidVersionCode() {
|
||||
return Input.getInput('androidVersionCode') || '';
|
||||
}
|
||||
static get androidAppBundle() {
|
||||
core.warning('androidAppBundle is deprecated, please use androidExportType instead');
|
||||
const input = Input.getInput('androidAppBundle') || false;
|
||||
return input === 'true';
|
||||
}
|
||||
static get androidExportType() {
|
||||
// TODO: remove this in V3
|
||||
const exportType = Input.getInput('androidExportType') || '';
|
||||
if (exportType !== '') {
|
||||
return exportType;
|
||||
}
|
||||
return Input.androidAppBundle ? 'androidAppBundle' : 'androidPackage';
|
||||
// End TODO
|
||||
// Use this in V3 when androidAppBundle is removed
|
||||
// return Input.getInput('androidExportType') || 'androidPackage';
|
||||
return Input.getInput('androidExportType') || 'androidPackage';
|
||||
}
|
||||
static get androidKeystoreName() {
|
||||
return Input.getInput('androidKeystoreName') || '';
|
||||
@@ -6802,6 +6790,9 @@ class Input {
|
||||
static get unityLicense() {
|
||||
return Input.getInput('UNITY_LICENSE');
|
||||
}
|
||||
static get dockerWorkspacePath() {
|
||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||
}
|
||||
static ToEnvVarFormat(input) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
@@ -7522,12 +7513,6 @@ class Versioning {
|
||||
static get ref() {
|
||||
return process.env.GITHUB_REF;
|
||||
}
|
||||
/**
|
||||
* The commit SHA that triggered the workflow run.
|
||||
*/
|
||||
static get sha() {
|
||||
return process.env.GITHUB_SHA;
|
||||
}
|
||||
/**
|
||||
* Maximum number of lines to print when logging the git diff
|
||||
*/
|
||||
@@ -7672,7 +7657,7 @@ class Versioning {
|
||||
* identifies the current commit.
|
||||
*/
|
||||
static async getVersionDescription() {
|
||||
return this.git(['describe', '--long', '--tags', '--always', this.sha]);
|
||||
return this.git(['describe', '--long', '--tags', '--always', 'HEAD']);
|
||||
}
|
||||
/**
|
||||
* Returns whether there are uncommitted changes that are not ignored.
|
||||
@@ -7709,10 +7694,9 @@ class Versioning {
|
||||
/**
|
||||
* Get the total number of commits on head.
|
||||
*
|
||||
* Note: HEAD should not be used, as it may be detached, resulting in an additional count.
|
||||
*/
|
||||
static async getTotalNumberOfCommits() {
|
||||
const numberOfCommitsAsString = await this.git(['rev-list', '--count', this.sha]);
|
||||
const numberOfCommitsAsString = await this.git(['rev-list', '--count', 'HEAD']);
|
||||
return Number.parseInt(numberOfCommitsAsString, 10);
|
||||
}
|
||||
/**
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/platforms/ubuntu/steps/build.sh
vendored
1
dist/platforms/ubuntu/steps/build.sh
vendored
@@ -153,6 +153,7 @@ fi
|
||||
|
||||
# Make a given user owner of all artifacts
|
||||
if [[ -n "$CHOWN_FILES_TO" ]]; then
|
||||
echo "Changing ownership of files to $CHOWN_FILES_TO for $BUILD_PATH_FULL and $UNITY_PROJECT_PATH"
|
||||
chown -R "$CHOWN_FILES_TO" "$BUILD_PATH_FULL"
|
||||
chown -R "$CHOWN_FILES_TO" "$UNITY_PROJECT_PATH"
|
||||
fi
|
||||
|
||||
@@ -9,8 +9,8 @@ else
|
||||
git config --global credential.helper store
|
||||
git config --global --replace-all url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf ssh://git@github.com/
|
||||
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf git@github.com
|
||||
|
||||
git config --global --add url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||
|
||||
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||
git config --global url."https://git:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||
|
||||
|
||||
9
dist/platforms/windows/entrypoint.ps1
vendored
9
dist/platforms/windows/entrypoint.ps1
vendored
@@ -1,6 +1,3 @@
|
||||
# Activate Unity
|
||||
& "c:\steps\activate.ps1"
|
||||
|
||||
# Import any necessary registry keys, ie: location of windows 10 sdk
|
||||
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
||||
Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname}
|
||||
@@ -8,6 +5,12 @@ Get-ChildItem -Path c:\regkeys -File | Foreach {reg import $_.fullname}
|
||||
# Register the Visual Studio installation so Unity can find it
|
||||
regsvr32 C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
|
||||
|
||||
# Setup Git Credentials
|
||||
& "c:\steps\set_gitcredential.ps1"
|
||||
|
||||
# Activate Unity
|
||||
& "c:\steps\activate.ps1"
|
||||
|
||||
# Build the project
|
||||
& "c:\steps\build.ps1"
|
||||
|
||||
|
||||
20
dist/platforms/windows/set_gitcredential.ps1
vendored
Normal file
20
dist/platforms/windows/set_gitcredential.ps1
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
if ([string]::IsNullOrEmpty($env:GIT_PRIVATE_TOKEN)) {
|
||||
Write-Host "GIT_PRIVATE_TOKEN unset skipping"
|
||||
}
|
||||
else {
|
||||
Write-Host "GIT_PRIVATE_TOKEN is set configuring git credentials"
|
||||
|
||||
git config --global credential.helper store
|
||||
git config --global --replace-all "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com"
|
||||
git config --global --add "url.https://token:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
|
||||
|
||||
git config --global "url.https://ssh:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
|
||||
git config --global "url.https://git:$env:GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
|
||||
}
|
||||
|
||||
Write-Host "---------- git config --list -------------"
|
||||
git config --list
|
||||
|
||||
Write-Host "---------- git config --list --show-origin -------------"
|
||||
git config --list --show-origin
|
||||
Reference in New Issue
Block a user