diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9396d6cb..b00128c5 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,6 +12,9 @@ #### Successful Workflow Run Link +PRs don't have access to secrets so you will need to provide a link to a successful run of the workflows from your own +repo. + - ... #### Checklist diff --git a/action.yml b/action.yml index 02b4d3f1..e0ccba40 100644 --- a/action.yml +++ b/action.yml @@ -270,5 +270,5 @@ branding: icon: 'box' color: 'gray-dark' runs: - using: 'node16' + using: 'node20' main: 'dist/index.js' diff --git a/dist/BlankProject/Packages/.DS_Store b/dist/BlankProject/Packages/.DS_Store deleted file mode 100644 index d2dd4122..00000000 Binary files a/dist/BlankProject/Packages/.DS_Store and /dev/null differ diff --git a/dist/index.js b/dist/index.js index b63cde65..44232ca2 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 02291496..f5a90303 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/platforms/ubuntu/steps/activate.sh b/dist/platforms/ubuntu/steps/activate.sh index efe95b83..9e051249 100755 --- a/dist/platforms/ubuntu/steps/activate.sh +++ b/dist/platforms/ubuntu/steps/activate.sh @@ -75,11 +75,12 @@ else # echo "License activation strategy could not be determined." echo "" - echo "Visit https://game.ci/docs/github/getting-started for more" + echo "Visit https://game.ci/docs/github/activation for more" echo "details on how to set up one of the possible activation strategies." echo "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \ -or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER." +or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER. See more info at https://game.ci/docs/github/activation" + # Immediately exit as no UNITY_EXIT_CODE can be derived. exit 1; @@ -98,6 +99,3 @@ else echo "::error ::There was an error while trying to activate the Unity license." exit $UNITY_EXIT_CODE fi - -# Return to previous working directory -popd diff --git a/dist/platforms/ubuntu/steps/return_license.sh b/dist/platforms/ubuntu/steps/return_license.sh index 2984f701..3555e1de 100755 --- a/dist/platforms/ubuntu/steps/return_license.sh +++ b/dist/platforms/ubuntu/steps/return_license.sh @@ -1,11 +1,6 @@ #!/usr/bin/env bash -# Run in ACTIVATE_LICENSE_PATH directory -echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory." -pushd "$ACTIVATE_LICENSE_PATH" - - -if [[ -n "$UNITY_LICENSING_SERVER" ]]; then # +if [[ -n "$UNITY_LICENSING_SERVER" ]]; then # # Return any floating license used. # @@ -25,6 +20,3 @@ elif [[ -n "$UNITY_SERIAL" ]]; then -password "$UNITY_PASSWORD" \ -projectPath "/BlankProject" fi - -# Return to previous working directory -popd diff --git a/dist/platforms/windows/activate.ps1 b/dist/platforms/windows/activate.ps1 index 897ec17e..1f630983 100644 --- a/dist/platforms/windows/activate.ps1 +++ b/dist/platforms/windows/activate.ps1 @@ -6,11 +6,64 @@ Write-Output "# Activating #" Write-Output "###########################" Write-Output "" -& "$Env:UNITY_PATH/Editor/Unity.exe" -batchmode -quit -nographics ` - -username $Env:UNITY_EMAIL ` - -password $Env:UNITY_PASSWORD ` - -serial $Env:UNITY_SERIAL ` - -projectPath "c:/BlankProject" ` - -logfile - | Out-Host +if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD}) ) +{ + # + # SERIAL LICENSE MODE + # + # This will activate unity, using the serial activation process. + # + Write-Output "Requesting activation" -$ACTIVATION_EXIT_CODE = $LASTEXITCODE + $ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "-batchmode ` + -quit ` + -nographics ` + -username $Env:UNITY_EMAIL ` + -password $Env:UNITY_PASSWORD ` + -serial $Env:UNITY_SERIAL ` + -projectPath c:/BlankProject ` + -logfile -" + + # Cache the handle so exit code works properly + # https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait + $unityHandle = $ACTIVATION_OUTPUT.Handle + + while ($true) { + if ($ACTIVATION_OUTPUT.HasExited) { + $ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode + + # Display results + if ($ACTIVATION_EXIT_CODE -eq 0) + { + Write-Output "Activation Succeeded" + } else + { + Write-Output "Activation failed, with exit code $ACTIVATION_EXIT_CODE" + } + + break + } + + Start-Sleep -Seconds 3 + } +} +else +{ + # + # NO LICENSE ACTIVATION STRATEGY MATCHED + # + # This will exit since no activation strategies could be matched. + # + Write-Output "License activation strategy could not be determined." + Write-Output "" + Write-Output "Visit https://game.ci/docs/github/activation for more" + Write-Output "details on how to set up one of the possible activation strategies." + + Write-Output "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \ +or UNITY_LICENSE. See more info at https://game.ci/docs/github/activation" + + $ACTIVATION_EXIT_CODE = 1; +} diff --git a/dist/platforms/windows/build.ps1 b/dist/platforms/windows/build.ps1 index 751cf9d2..5622fae6 100644 --- a/dist/platforms/windows/build.ps1 +++ b/dist/platforms/windows/build.ps1 @@ -156,10 +156,10 @@ $unityArgs = @( # Remove null items as that will fail the Start-Process call $unityArgs = $unityArgs | Where-Object { $_ -ne $null } -$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Unity.exe" ` - -ArgumentList $unityArgs ` - -PassThru ` - -NoNewWindow +$unityProcess = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" ` + -ArgumentList $unityArgs ` + -PassThru ` + -NoNewWindow # Cache the handle so exit code works properly # https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait diff --git a/dist/platforms/windows/return_license.ps1 b/dist/platforms/windows/return_license.ps1 index 709c3895..edf7ec2e 100644 --- a/dist/platforms/windows/return_license.ps1 +++ b/dist/platforms/windows/return_license.ps1 @@ -6,9 +6,47 @@ Write-Output "# Return License #" Write-Output "###########################" Write-Output "" -& "$Env:UNITY_PATH\Editor\Unity.exe" -batchmode -quit -nographics ` - -username $Env:UNITY_EMAIL ` - -password $Env:UNITY_PASSWORD ` - -returnlicense ` - -projectPath "c:/BlankProject" ` - -logfile - | Out-Host +if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD})) +{ + # + # SERIAL LICENSE MODE + # + # This will return the license that is currently in use. + # + $RETURN_LICENSE_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH/Editor/Unity.exe" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "-batchmode ` + -quit ` + -nographics ` + -username $Env:UNITY_EMAIL ` + -password $Env:UNITY_PASSWORD ` + -returnlicense ` + -projectPath c:/BlankProject ` + -logfile -" + + # Cache the handle so exit code works properly + # https://stackoverflow.com/questions/10262231/obtaining-exitcode-using-start-process-and-waitforexit-instead-of-wait + $unityHandle = $RETURN_LICENSE_OUTPUT.Handle + + while ($true) { + if ($RETURN_LICENSE_OUTPUT.HasExited) { + $RETURN_LICENSE_EXIT_CODE = $RETURN_LICENSE_OUTPUT.ExitCode + + # Display results + if ($RETURN_LICENSE_EXIT_CODE -eq 0) + { + Write-Output "License Return Succeeded" + } else + { + Write-Output "License Return failed, with exit code $RETURN_LICENSE_EXIT_CODE" + Write-Output "::warning ::License Return failed! If this is a Pro License you might need to manually ` +free the seat in your Unity admin panel or you might run out of seats to activate with." + } + + break + } + + Start-Sleep -Seconds 3 + } +} diff --git a/dist/platforms/windows/set_gitcredential.ps1 b/dist/platforms/windows/set_gitcredential.ps1 index afb947c6..f77f31b8 100644 --- a/dist/platforms/windows/set_gitcredential.ps1 +++ b/dist/platforms/windows/set_gitcredential.ps1 @@ -1,4 +1,4 @@ -if ([string]::IsNullOrEmpty($env:GIT_PRIVATE_TOKEN)) { +if ($null -eq ${env:GIT_PRIVATE_TOKEN}) { Write-Host "GIT_PRIVATE_TOKEN unset skipping" } else { @@ -8,7 +8,7 @@ else { 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:" } diff --git a/src/model/docker.ts b/src/model/docker.ts index 6d7b2843..1beb4923 100644 --- a/src/model/docker.ts +++ b/src/model/docker.ts @@ -21,6 +21,9 @@ class Docker { break; case 'win32': runCommand = this.getWindowsCommand(image, parameters); + break; + default: + throw new Error(`Operation system, ${process.platform}, is not supported yet.`); } options.silent = silent; diff --git a/src/model/image-tag.ts b/src/model/image-tag.ts index cf484708..cf4de698 100644 --- a/src/model/image-tag.ts +++ b/src/model/image-tag.ts @@ -169,7 +169,7 @@ class ImageTag { if (customImage) return customImage; - return `${image}:${tag}`; // '0' here represents the docker repo version + return `${image}:${tag}`; } }