Skip to content

Commit e093d1e

Browse files
salmanmkcaparnajyothi-ypriyagupta108
authored
Node 24 upgrade (#624)
* Node 24 upgrade Doing an upgrade for node 24, node 24 is stricter with types so need to add a type for achitecture * format * package updates * fix for check failures * upgrade @types/node * update package.json version * check failure fix * package-lock.json update * update node24 * npm run format * npm run format * node update from the workflows * Upgrade `actions/checkout` to v5 and `actions/setup-go` to v6 in README.md --------- Co-authored-by: Aparna Jyothi <[email protected]> Co-authored-by: Priya Gupta <[email protected]>
1 parent 1d76b95 commit e093d1e

File tree

11 files changed

+67
-49
lines changed

11 files changed

+67
-49
lines changed

.github/workflows/basic-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
name: Basic validation
1616
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
1717
with:
18-
node-version: '20'
18+
node-version: '24.x'

.github/workflows/check-dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
name: Check dist/
1717
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
1818
with:
19-
node-version: '20'
19+
node-version: '24.x'

.licenses/npm/@types/node.dep.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.licenses/npm/undici-types.dep.yml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ Matching by [semver spec](https://github.com/npm/node-semver):
5050

5151
```yaml
5252
steps:
53-
- uses: actions/checkout@v4
54-
- uses: actions/setup-go@v5
53+
- uses: actions/checkout@v5
54+
- uses: actions/setup-go@v6
5555
with:
5656
go-version: '^1.13.1' # The Go version to download (if necessary) and use.
5757
- run: go version
5858
```
5959
6060
```yaml
6161
steps:
62-
- uses: actions/checkout@v4
63-
- uses: actions/setup-go@v5
62+
- uses: actions/checkout@v5
63+
- uses: actions/setup-go@v6
6464
with:
6565
go-version: '>=1.17.0'
6666
- run: go version
@@ -78,17 +78,17 @@ Matching an unstable pre-release:
7878

7979
```yaml
8080
steps:
81-
- uses: actions/checkout@v4
82-
- uses: actions/setup-go@v5
81+
- uses: actions/checkout@v5
82+
- uses: actions/setup-go@v6
8383
with:
8484
go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use.
8585
- run: go version
8686
```
8787

8888
```yaml
8989
steps:
90-
- uses: actions/checkout@v4
91-
- uses: actions/setup-go@v5
90+
- uses: actions/checkout@v5
91+
- uses: actions/setup-go@v6
9292
with:
9393
go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use.
9494
- run: go version
@@ -102,8 +102,8 @@ See [action.yml](action.yml)
102102

103103
```yaml
104104
steps:
105-
- uses: actions/checkout@v4
106-
- uses: actions/setup-go@v5
105+
- uses: actions/checkout@v5
106+
- uses: actions/setup-go@v6
107107
with:
108108
go-version: '1.16.1' # The Go version to download (if necessary) and use.
109109
- run: go run hello.go
@@ -123,8 +123,8 @@ want the most up-to-date Go version to always be used.
123123

124124
```yaml
125125
steps:
126-
- uses: actions/checkout@v4
127-
- uses: actions/setup-go@v5
126+
- uses: actions/checkout@v5
127+
- uses: actions/setup-go@v6
128128
with:
129129
go-version: '1.14'
130130
check-latest: true
@@ -144,17 +144,17 @@ set to `true`
144144

145145
```yaml
146146
steps:
147-
- uses: actions/checkout@v4
148-
- uses: actions/setup-go@v5
147+
- uses: actions/checkout@v5
148+
- uses: actions/setup-go@v6
149149
with:
150150
go-version: 'stable'
151151
- run: go run hello.go
152152
```
153153

154154
```yaml
155155
steps:
156-
- uses: actions/checkout@v4
157-
- uses: actions/setup-go@v5
156+
- uses: actions/checkout@v5
157+
- uses: actions/setup-go@v6
158158
with:
159159
go-version: 'oldstable'
160160
- run: go run hello.go
@@ -176,8 +176,8 @@ If some problem that prevents success caching happens then the action issues the
176176

177177
```yaml
178178
steps:
179-
- uses: actions/checkout@v4
180-
- uses: actions/setup-go@v5
179+
- uses: actions/checkout@v5
180+
- uses: actions/setup-go@v6
181181
with:
182182
go-version: '1.17'
183183
check-latest: true
@@ -210,8 +210,8 @@ If both the `go-version` and the `go-version-file` inputs are provided then the
210210

211211
```yaml
212212
steps:
213-
- uses: actions/checkout@v4
214-
- uses: actions/setup-go@v5
213+
- uses: actions/checkout@v5
214+
- uses: actions/setup-go@v6
215215
with:
216216
go-version-file: 'path/to/go.mod'
217217
- run: go version
@@ -228,9 +228,9 @@ jobs:
228228
go: [ '1.14', '1.13' ]
229229
name: Go ${{ matrix.go }} sample
230230
steps:
231-
- uses: actions/checkout@v4
231+
- uses: actions/checkout@v5
232232
- name: Setup go
233-
uses: actions/setup-go@v5
233+
uses: actions/setup-go@v6
234234
with:
235235
go-version: ${{ matrix.go }}
236236
- run: go run hello.go
@@ -258,7 +258,7 @@ If that fails as well the action will try to download versions directly from htt
258258
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
259259

260260
```yaml
261-
uses: actions/setup-go@v5
261+
uses: actions/setup-go@v6
262262
with:
263263
token: ${{ secrets.GH_DOTCOM_TOKEN }}
264264
go-version: '1.18'

package-lock.json

Lines changed: 15 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"name": "setup-go",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"private": true,
55
"description": "setup go action",
66
"main": "lib/setup-go.js",
7+
"engines": {
8+
"node": ">=24.0.0"
9+
},
710
"scripts": {
811
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
912
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
@@ -36,7 +39,7 @@
3639
},
3740
"devDependencies": {
3841
"@types/jest": "^29.5.14",
39-
"@types/node": "^20.11.28",
42+
"@types/node": "^24.1.0",
4043
"@types/semver": "^7.5.8",
4144
"@typescript-eslint/eslint-plugin": "^8.31.1",
4245
"@typescript-eslint/parser": "^8.35.1",

src/installer.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as sys from './system';
77
import fs from 'fs';
88
import os from 'os';
99
import {StableReleaseAlias, isSelfHosted} from './utils';
10+
import {Architecture} from './types';
1011

1112
export const GOTOOLCHAIN_ENV_VAR = 'GOTOOLCHAIN';
1213
export const GOTOOLCHAIN_LOCAL_VAL = 'local';
@@ -41,7 +42,7 @@ export async function getGo(
4142
versionSpec: string,
4243
checkLatest: boolean,
4344
auth: string | undefined,
44-
arch = os.arch()
45+
arch: Architecture = os.arch() as Architecture
4546
) {
4647
let manifest: tc.IToolRelease[] | undefined;
4748
const osPlat: string = os.platform();
@@ -153,7 +154,7 @@ async function resolveVersionFromManifest(
153154
versionSpec: string,
154155
stable: boolean,
155156
auth: string | undefined,
156-
arch: string,
157+
arch: Architecture,
157158
manifest: tc.IToolRelease[] | undefined
158159
): Promise<string | undefined> {
159160
try {
@@ -355,7 +356,7 @@ export async function getInfoFromManifest(
355356
versionSpec: string,
356357
stable: boolean,
357358
auth: string | undefined,
358-
arch = os.arch(),
359+
arch: Architecture = os.arch() as Architecture,
359360
manifest?: tc.IToolRelease[] | undefined
360361
): Promise<IGoVersionInfo | null> {
361362
let info: IGoVersionInfo | null = null;
@@ -381,7 +382,7 @@ export async function getInfoFromManifest(
381382

382383
async function getInfoFromDist(
383384
versionSpec: string,
384-
arch: string
385+
arch: Architecture
385386
): Promise<IGoVersionInfo | null> {
386387
const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
387388
if (!version) {
@@ -400,7 +401,7 @@ async function getInfoFromDist(
400401

401402
export async function findMatch(
402403
versionSpec: string,
403-
arch = os.arch()
404+
arch: Architecture = os.arch() as Architecture
404405
): Promise<IGoVersion | undefined> {
405406
const archFilter = sys.getArch(arch);
406407
const platFilter = sys.getPlatform();
@@ -517,7 +518,10 @@ export function parseGoVersionFile(versionFilePath: string): string {
517518
return contents.trim();
518519
}
519520

520-
async function resolveStableVersionDist(versionSpec: string, arch: string) {
521+
async function resolveStableVersionDist(
522+
versionSpec: string,
523+
arch: Architecture
524+
) {
521525
const archFilter = sys.getArch(arch);
522526
const platFilter = sys.getPlatform();
523527
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {isCacheFeatureAvailable} from './cache-utils';
88
import cp from 'child_process';
99
import fs from 'fs';
1010
import os from 'os';
11+
import {Architecture} from './types';
1112

1213
export async function run() {
1314
try {
@@ -21,10 +22,10 @@ export async function run() {
2122
const cache = core.getBooleanInput('cache');
2223
core.info(`Setup go version spec ${versionSpec}`);
2324

24-
let arch = core.getInput('architecture');
25+
let arch = core.getInput('architecture') as Architecture;
2526

2627
if (!arch) {
27-
arch = os.arch();
28+
arch = os.arch() as Architecture;
2829
}
2930

3031
if (versionSpec) {

src/system.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os from 'os';
2+
import {Architecture} from './types';
23

34
export function getPlatform(): string {
45
// darwin and linux match already
@@ -15,7 +16,7 @@ export function getPlatform(): string {
1516
return plat;
1617
}
1718

18-
export function getArch(arch: string): string {
19+
export function getArch(arch: Architecture): string {
1920
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
2021

2122
// wants amd64, 386, arm64, armv61, ppc641e, s390x

0 commit comments

Comments
 (0)