File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 npm run build
3535 npm run link
3636 unity-cli --version
37- unity-cli hub-install
37+ unity-cli hub-install --auto-update
3838 unity-cli activate-license --license personal --email "${{ secrets.UNITY_USERNAME }}" --password "${{ secrets.UNITY_PASSWORD }}"
3939 setup_output=$(unity-cli setup-unity --unity-version "${{ matrix.unity-version }}" --build-targets "${{ matrix.build-targets }}" --json)
4040 unity_editor_path=$(echo "$setup_output" | tail -n 1 | jq -r '.UNITY_EDITOR')
Original file line number Diff line number Diff line change 11{
22 "name" : " @rage-against-the-pixel/unity-cli" ,
3- "version" : " 1.0.3 " ,
3+ "version" : " 1.0.4 " ,
44 "description" : " A command line utility for the Unity Game Engine." ,
55 "author" : " RageAgainstThePixel" ,
66 "license" : " MIT" ,
Original file line number Diff line number Diff line change @@ -112,14 +112,18 @@ program.command('hub-version')
112112program . command ( 'hub-install' )
113113 . description ( 'Install the Unity Hub.' )
114114 . option ( '--verbose' , 'Enable verbose logging.' )
115+ . option ( '--auto-update' , 'Automatically updates the Unity Hub if it is already installed.' )
115116 . option ( '--json' , 'Prints the last line of output as JSON string.' )
116117 . action ( async ( options ) => {
117118 if ( options . verbose ) {
118119 Logger . instance . logLevel = LogLevel . DEBUG ;
119120 }
120121
122+ Logger . instance . debug ( JSON . stringify ( options ) ) ;
123+
124+ let autoUpdate : boolean = options . autoUpdate === undefined ? false : true ;
121125 const unityHub = new UnityHub ( ) ;
122- const hubPath = await unityHub . Install ( ) ;
126+ const hubPath = await unityHub . Install ( autoUpdate ) ;
123127
124128 if ( options . json ) {
125129 process . stdout . write ( `\n${ JSON . stringify ( { UNITY_HUB_PATH : hubPath } ) } \n` ) ;
Original file line number Diff line number Diff line change @@ -163,9 +163,10 @@ export class UnityHub {
163163 /**
164164 * Installs or updates the Unity Hub.
165165 * If the Unity Hub is already installed, it will be updated to the latest version.
166+ * @param autoUpdate If true, automatically updates the Unity Hub if it is already installed. Default is true.
166167 * @returns The path to the Unity Hub executable.
167168 */
168- public async Install ( ) : Promise < string > {
169+ public async Install ( autoUpdate : boolean = true ) : Promise < string > {
169170 let isInstalled = false ;
170171 try {
171172 await fs . promises . access ( this . executable , fs . constants . X_OK ) ;
@@ -174,7 +175,7 @@ export class UnityHub {
174175 await this . installHub ( ) ;
175176 }
176177
177- if ( isInstalled ) {
178+ if ( isInstalled && autoUpdate ) {
178179 const installedVersion : SemVer = await this . getInstalledHubVersion ( ) ;
179180 this . logger . ci ( `Installed Unity Hub version: ${ installedVersion . version } ` ) ;
180181 let latestVersion : SemVer | undefined = undefined ;
You can’t perform that action at this time.
0 commit comments