From 024f9e05c69bd1fa5e716c0fdaf140004da1ae68 Mon Sep 17 00:00:00 2001 From: Azuk 443 Date: Thu, 11 Apr 2024 22:46:16 +0800 Subject: [PATCH] fix pipeline node:18 is a workaround for npm/cli/issues/7076 --- .gitlab-ci.yml | 10 ++++++---- cached-restore.sh | 10 ---------- 2 files changed, 6 insertions(+), 14 deletions(-) delete mode 100755 cached-restore.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a48dd9b..be9d76f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,6 @@ -image: node:lts-bullseye +image: + name: node:18 + pull_policy: if-not-present stages: - build @@ -10,10 +12,10 @@ gatsby-build: CHOKIDAR_USEPOLLING: 1 cache: paths: - - node_modules/ + - .npm/ script: - - bash cached-restore.sh - - yarn run build + - npm ci --cache .npm --prefer-offline + - npm run build artifacts: paths: - public diff --git a/cached-restore.sh b/cached-restore.sh deleted file mode 100755 index d4af6dd..0000000 --- a/cached-restore.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if cmp -s "package-lock.json" "node_modules/package-lock.json"; then - echo "package-lock.json did not change, skipping install" -else - echo "package-lock.json changed, reinstalling packages" - npm config set registry https://registry.npmmirror.com - npm ci - cp package-lock.json node_modules/package-lock.json -fi