From 5912fcc3932ae57beb3357861914b39fa06ab611 Mon Sep 17 00:00:00 2001 From: Zack Pollard <zackpollard@ymail.com> Date: Tue, 25 Jun 2024 16:01:15 +0300 Subject: [PATCH] ci: use .nvmrc for node-setup node-version in github actions (#10619) * chore: add node version pinning with .nvmrc and volta for the typescript sdk * ci: add missing setup-node actions and use .nvmrc for setup-node node-version --- .github/workflows/cli.yml | 2 +- .github/workflows/docs-build.yml | 5 +++++ .github/workflows/sdk.yml | 2 +- .github/workflows/test.yml | 26 +++++++++++++++++++++++--- open-api/typescript-sdk/.nvmrc | 1 + open-api/typescript-sdk/package.json | 5 ++++- 6 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 open-api/typescript-sdk/.nvmrc diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 71df34395e..2d016c564a 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -33,7 +33,7 @@ jobs: # Setup .npmrc file to publish to npm - uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version-file: './cli/.nvmrc' registry-url: 'https://registry.npmjs.org' - name: Prepare SDK run: npm ci --prefix ../open-api/typescript-sdk/ diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml index bd20286e62..32e9dc399a 100644 --- a/.github/workflows/docs-build.yml +++ b/.github/workflows/docs-build.yml @@ -26,6 +26,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './docs/.nvmrc' + - name: Run npm install run: npm ci diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index cd3dbe2b10..e581da4b16 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -19,7 +19,7 @@ jobs: # Setup .npmrc file to publish to npm - uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version-file: './open-api/typescript-sdk/.nvmrc' registry-url: 'https://registry.npmjs.org' - name: Install deps run: npm ci diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 204ec88363..34a9d984a0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './server/.nvmrc' + - name: Run npm install run: npm ci @@ -54,7 +59,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version-file: './cli/.nvmrc' - name: Setup typescript-sdk run: npm ci && npm run build @@ -93,7 +98,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version-file: './cli/.nvmrc' - name: Setup typescript-sdk run: npm ci && npm run build @@ -122,6 +127,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './web/.nvmrc' + - name: Run setup typescript-sdk run: npm ci && npm run build working-directory: ./open-api/typescript-sdk @@ -165,7 +175,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version-file: './e2e/.nvmrc' - name: Run setup typescript-sdk run: npm ci && npm run build @@ -273,6 +283,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './server/.nvmrc' + - name: Install server dependencies run: npm --prefix=server ci @@ -323,6 +338,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './server/.nvmrc' + - name: Install server dependencies run: npm ci diff --git a/open-api/typescript-sdk/.nvmrc b/open-api/typescript-sdk/.nvmrc new file mode 100644 index 0000000000..9075659573 --- /dev/null +++ b/open-api/typescript-sdk/.nvmrc @@ -0,0 +1 @@ +20.15.0 diff --git a/open-api/typescript-sdk/package.json b/open-api/typescript-sdk/package.json index f8505af0f5..0e1b598e80 100644 --- a/open-api/typescript-sdk/package.json +++ b/open-api/typescript-sdk/package.json @@ -19,12 +19,15 @@ "@oazapfts/runtime": "^1.0.2" }, "devDependencies": { - "@types/node": "^20.11.0", + "@types/node": "^20.11", "typescript": "^5.3.3" }, "repository": { "type": "git", "url": "git+https://github.com/immich-app/immich.git", "directory": "open-api/typescript-sdk" + }, + "volta": { + "node": "20.15.0" } }