From b008cac781752925be03e220baa474f08c606a93 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 31 Jul 2022 00:39:49 +0200 Subject: [PATCH] Fix parameters in netlify cli script (#2258) * Fix parameters in netlify cli script * Use node-modules linker when deploying to netlify Signed-off-by: Tilman Vatteroth --- .github/workflows/deploy-main.yml | 3 +++ .github/workflows/deploy-pr.yml | 3 +++ netlify/deploy-main.sh | 5 ++--- netlify/deploy-pr.sh | 5 ++--- netlify/netlify-cli.sh | 2 +- netlify/patch-files.sh | 2 ++ package.json | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml index 26836b3b8..07d9383e5 100644 --- a/.github/workflows/deploy-main.yml +++ b/.github/workflows/deploy-main.yml @@ -34,6 +34,9 @@ jobs: with: node-version: 18 + - name: Patch files + run: bash netlify/patch-files.sh + - name: Install dependencies run: yarn install --immutable diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index 730837020..a20450b6b 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -34,6 +34,9 @@ jobs: with: node-version: 18 + - name: Patch files + run: bash netlify/patch-files.sh + - name: Install dependencies run: yarn install --immutable diff --git a/netlify/deploy-main.sh b/netlify/deploy-main.sh index add4e18b8..dd3eef71c 100755 --- a/netlify/deploy-main.sh +++ b/netlify/deploy-main.sh @@ -6,12 +6,11 @@ # SPDX-License-Identifier: AGPL-3.0-only # -cd "$(dirname "$0")" -json=$(./netlify-cli.sh deploy --build --prod --json --message "${1:0:8}: $2") +json=$($(dirname "$0")/netlify-cli.sh deploy --build --prod --json --message "${1:0:8}: $2") if [ $? -ne 0 ]; then echo "Error while executing netlify! Will try again without json..." - ./netlify-cli.sh deploy --build --prod --message "${1:0:8}: $2" + $(dirname "$0")/netlify-cli.sh deploy --build --prod --message "${1:0:8}: $2" exit 1 fi diff --git a/netlify/deploy-pr.sh b/netlify/deploy-pr.sh index 3e655ab2d..cfc1fc47b 100755 --- a/netlify/deploy-pr.sh +++ b/netlify/deploy-pr.sh @@ -6,12 +6,11 @@ # SPDX-License-Identifier: AGPL-3.0-only # -cd "$(dirname "$0")" -json=$(./netlify-cli.sh deploy --build --context deploy-preview --alias "$1" --json --message "[#$1] $2") +json=$($(dirname "$0")/netlify-cli.sh deploy --build --context deploy-preview --alias "$1" --json --message "[#$1] $2") if [ $? -ne 0 ]; then echo "Error while executing netlify! Will try again without json..." - ./netlify-cli.sh deploy --build --context deploy-preview --alias "$1" --message "[#$1] $2" + $(dirname "$0")/netlify-cli.sh deploy --build --context deploy-preview --alias "$1" --message "[#$1] $2" exit 1 fi diff --git a/netlify/netlify-cli.sh b/netlify/netlify-cli.sh index fca4996ba..e57c21bc5 100755 --- a/netlify/netlify-cli.sh +++ b/netlify/netlify-cli.sh @@ -7,4 +7,4 @@ # NETLIFY_VERSION=10.13.0 -exec npx --yes netlify-cli@${NETLIFY_VERSION} +exec npx --yes netlify-cli@${NETLIFY_VERSION} $@ diff --git a/netlify/patch-files.sh b/netlify/patch-files.sh index 283f6aefd..7519350a0 100644 --- a/netlify/patch-files.sh +++ b/netlify/patch-files.sh @@ -7,6 +7,8 @@ set -e +echo 'Patch yarnrc to use node_modules' +sed -i "s/nodeLinker: pnp/nodeLinker: node-modules/" .yarnrc.yml echo 'Patch intro.md to include netlify banner.' cp netlify/intro.md public/mock-public/intro.md echo 'Patch motd.md to include privacy policy.' diff --git a/package.json b/package.json index c66686e0d..9a3729003 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "license": "AGPL-3.0", "scripts": { "build": "next build", - "build:netlify": "bash netlify/patch-files.sh && cross-env NEXT_PUBLIC_IGNORE_IFRAME_ORIGIN_CONFIG=true yarn build:mock", + "build:netlify": "cross-env NEXT_PUBLIC_IGNORE_IFRAME_ORIGIN_CONFIG=true yarn build:mock", "build:mock": "cross-env NEXT_PUBLIC_USE_MOCK_API=true next build", "build:test": "cross-env NEXT_PUBLIC_USE_MOCK_API=true NEXT_PUBLIC_TEST_MODE=true next build", "build:for-real-backend": "cross-env NEXT_PUBLIC_USE_MOCK_API=false NEXT_PUBLIC_BACKEND_BASE_URL=/ next build",