diff --git a/.licenses/npm/@types/node.dep.yml b/.licenses/npm/@types/node.dep.yml index 10103ad..c8b37b8 100644 --- a/.licenses/npm/@types/node.dep.yml +++ b/.licenses/npm/@types/node.dep.yml @@ -1,6 +1,6 @@ --- name: "@types/node" -version: 20.11.28 +version: 24.2.1 type: npm summary: TypeScript definitions for node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node diff --git a/.licenses/npm/form-data-2.5.5.dep.yml b/.licenses/npm/form-data-2.5.5.dep.yml index 1c019c2..fc5fc9e 100644 --- a/.licenses/npm/form-data-2.5.5.dep.yml +++ b/.licenses/npm/form-data-2.5.5.dep.yml @@ -4,7 +4,9 @@ version: 2.5.5 type: npm summary: A library to create readable "multipart/form-data" streams. Can be used to submit forms and file uploads to other web applications. + homepage: + license: mit licenses: - sources: License diff --git a/.licenses/npm/undici-types.dep.yml b/.licenses/npm/undici-types.dep.yml index a65b8af..2fb3a54 100644 --- a/.licenses/npm/undici-types.dep.yml +++ b/.licenses/npm/undici-types.dep.yml @@ -1,15 +1,17 @@ --- name: undici-types -version: 5.26.5 +version: 7.10.0 type: npm summary: A stand-alone types package for Undici homepage: https://undici.nodejs.org license: mit licenses: -- sources: Auto-generated MIT license text +- sources: LICENSE text: | MIT License + Copyright (c) Matteo Collina and Undici contributors + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/package-lock.json b/package-lock.json index c548f17..4481936 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@types/jest": "^29.5.14", - "@types/node": "^20.11.28", + "@types/node": "^24.2.1", "@types/semver": "^7.5.8", "@typescript-eslint/eslint-plugin": "^8.31.1", "@typescript-eslint/parser": "^8.35.1", @@ -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": { @@ -1599,11 +1602,12 @@ } }, "node_modules/@types/node": { - "version": "20.11.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", - "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", + "version": "24.2.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.1.tgz", + "integrity": "sha512-DRh5K+ka5eJic8CjH7td8QpYEV6Zo10gfRkjHCO3weqZHWDtAaSTFtl4+VMqOJ4N5jcuhZ9/l+yy8rVgw7BQeQ==", + "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~7.10.0" } }, "node_modules/@types/node-fetch": { @@ -5973,9 +5977,10 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz", + "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==", + "license": "MIT" }, "node_modules/update-browserslist-db": { "version": "1.0.13", diff --git a/package.json b/package.json index e6252e2..d97099b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,12 @@ { "name": "setup-go", - "version": "5.0.0", + "version": "6.0.0", "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}\"", @@ -36,7 +39,7 @@ }, "devDependencies": { "@types/jest": "^29.5.14", - "@types/node": "^20.11.28", + "@types/node": "^24.2.1", "@types/semver": "^7.5.8", "@typescript-eslint/eslint-plugin": "^8.31.1", "@typescript-eslint/parser": "^8.35.1", diff --git a/src/installer.ts b/src/installer.ts index 1b5f20f..2d349e9 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -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 { 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 { let info: IGoVersionInfo | null = null; @@ -379,7 +380,7 @@ export async function getInfoFromManifest( async function getInfoFromDist( versionSpec: string, - arch: string + arch: Architecture ): Promise { 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 { const archFilter = sys.getArch(arch); const platFilter = sys.getPlatform(); @@ -502,7 +503,10 @@ 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'; diff --git a/src/main.ts b/src/main.ts index 690d277..3b517a2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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) { diff --git a/src/system.ts b/src/system.ts index e54146d..b549d22 100644 --- a/src/system.ts +++ b/src/system.ts @@ -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 diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..288588e --- /dev/null +++ b/src/types.ts @@ -0,0 +1,2 @@ +// match what @actions/tool-cache expects +export type Architecture = string;