mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-31 19:13:43 +00:00 
			
		
		
		
	Node 24 upgrade
Doing an upgrade for node 24, node 24 is stricter with types so need to add a type for achitecture
This commit is contained in:
		
							parent
							
								
									8e57b58e57
								
							
						
					
					
						commit
						abe7d6b8af
					
				
							
								
								
									
										3
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -35,6 +35,9 @@ | ||||
|         "prettier": "^2.8.4", | ||||
|         "ts-jest": "^29.3.2", | ||||
|         "typescript": "^5.8.3" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=24.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@aashutoshrathi/word-wrap": { | ||||
|  | ||||
| @ -4,6 +4,9 @@ | ||||
|   "private": true, | ||||
|   "description": "setup go action", | ||||
|   "main": "lib/setup-go.js", | ||||
|    "engines": { | ||||
|     "node": ">=24.0.0" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts", | ||||
|     "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"", | ||||
|  | ||||
| @ -7,6 +7,7 @@ import * as sys from './system'; | ||||
| import fs from 'fs'; | ||||
| import os from 'os'; | ||||
| import {StableReleaseAlias, isSelfHosted} from './utils'; | ||||
| import {Architecture} from './types'; | ||||
| 
 | ||||
| const MANIFEST_REPO_OWNER = 'actions'; | ||||
| const MANIFEST_REPO_NAME = 'go-versions'; | ||||
| @ -39,7 +40,7 @@ export async function getGo( | ||||
|   versionSpec: string, | ||||
|   checkLatest: boolean, | ||||
|   auth: string | undefined, | ||||
|   arch = os.arch() | ||||
|   arch: Architecture = os.arch() as Architecture | ||||
| ) { | ||||
|   let manifest: tc.IToolRelease[] | undefined; | ||||
|   const osPlat: string = os.platform(); | ||||
| @ -151,7 +152,7 @@ async function resolveVersionFromManifest( | ||||
|   versionSpec: string, | ||||
|   stable: boolean, | ||||
|   auth: string | undefined, | ||||
|   arch: string, | ||||
|   arch: Architecture, | ||||
|   manifest: tc.IToolRelease[] | undefined | ||||
| ): Promise<string | undefined> { | ||||
|   try { | ||||
| @ -353,7 +354,7 @@ export async function getInfoFromManifest( | ||||
|   versionSpec: string, | ||||
|   stable: boolean, | ||||
|   auth: string | undefined, | ||||
|   arch = os.arch(), | ||||
|   arch: Architecture = os.arch() as Architecture, | ||||
|   manifest?: tc.IToolRelease[] | undefined | ||||
| ): Promise<IGoVersionInfo | null> { | ||||
|   let info: IGoVersionInfo | null = null; | ||||
| @ -379,7 +380,7 @@ export async function getInfoFromManifest( | ||||
| 
 | ||||
| async function getInfoFromDist( | ||||
|   versionSpec: string, | ||||
|   arch: string | ||||
|   arch: Architecture | ||||
| ): Promise<IGoVersionInfo | null> { | ||||
|   const version: IGoVersion | undefined = await findMatch(versionSpec, arch); | ||||
|   if (!version) { | ||||
| @ -398,7 +399,7 @@ async function getInfoFromDist( | ||||
| 
 | ||||
| export async function findMatch( | ||||
|   versionSpec: string, | ||||
|   arch = os.arch() | ||||
|   arch: Architecture = os.arch() as Architecture | ||||
| ): Promise<IGoVersion | undefined> { | ||||
|   const archFilter = sys.getArch(arch); | ||||
|   const platFilter = sys.getPlatform(); | ||||
| @ -502,7 +503,7 @@ export function parseGoVersionFile(versionFilePath: string): string { | ||||
|   return contents.trim(); | ||||
| } | ||||
| 
 | ||||
| async function resolveStableVersionDist(versionSpec: string, arch: string) { | ||||
| async function resolveStableVersionDist(versionSpec: string, arch: Architecture) { | ||||
|   const archFilter = sys.getArch(arch); | ||||
|   const platFilter = sys.getPlatform(); | ||||
|   const dlUrl = 'https://golang.org/dl/?mode=json&include=all'; | ||||
|  | ||||
| @ -8,6 +8,7 @@ import {isCacheFeatureAvailable} from './cache-utils'; | ||||
| import cp from 'child_process'; | ||||
| import fs from 'fs'; | ||||
| import os from 'os'; | ||||
| import {Architecture} from './types'; | ||||
| 
 | ||||
| export async function run() { | ||||
|   try { | ||||
| @ -20,10 +21,10 @@ export async function run() { | ||||
|     const cache = core.getBooleanInput('cache'); | ||||
|     core.info(`Setup go version spec ${versionSpec}`); | ||||
| 
 | ||||
|     let arch = core.getInput('architecture'); | ||||
|     let arch = core.getInput('architecture') as Architecture; | ||||
| 
 | ||||
|     if (!arch) { | ||||
|       arch = os.arch(); | ||||
|       arch = os.arch() as Architecture; | ||||
|     } | ||||
| 
 | ||||
|     if (versionSpec) { | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| import os from 'os'; | ||||
| import {Architecture} from './types'; | ||||
| 
 | ||||
| export function getPlatform(): string { | ||||
|   // darwin and linux match already
 | ||||
| @ -15,7 +16,7 @@ export function getPlatform(): string { | ||||
|   return plat; | ||||
| } | ||||
| 
 | ||||
| export function getArch(arch: string): string { | ||||
| export function getArch(arch: Architecture): string { | ||||
|   // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
 | ||||
| 
 | ||||
|   // wants amd64, 386, arm64, armv61, ppc641e, s390x
 | ||||
|  | ||||
							
								
								
									
										2
									
								
								src/types.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/types.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| // match what @actions/tool-cache expects
 | ||||
| export type Architecture = string; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user