From cc3d8c9d6cbec2e7e5b29b928a96d3de296dd3b2 Mon Sep 17 00:00:00 2001 From: Ian Maddaus Date: Wed, 20 Mar 2024 18:04:32 -0400 Subject: [PATCH] Deploy using sh scripts Signed-off-by: Ian Maddaus --- .gitignore | 7 +++++++ netlify.toml | 8 ++++---- scripts/local-server.sh | 12 ++++++++++++ scripts/netlify-branch-deploy.sh | 14 ++++++++++++++ scripts/netlify-deploy-preview.sh | 14 ++++++++++++++ scripts/netlify-deploy-production.sh | 14 ++++++++++++++ 6 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 scripts/local-server.sh create mode 100644 scripts/netlify-branch-deploy.sh create mode 100644 scripts/netlify-deploy-preview.sh create mode 100644 scripts/netlify-deploy-production.sh diff --git a/.gitignore b/.gitignore index e3850cf3be..8e0e690db2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ .DS_Store +# Hugo/Go workspace files +*.work +*.work.sum + # ignore doctree files in translation folders *.doctree *.pickle @@ -26,6 +30,9 @@ static/fonts/fontawesome node_modules vendor +# dart-sass files for local dev testing +/dart-sass + # temp file created by hugo .hugo_build.lock diff --git a/netlify.toml b/netlify.toml index 197f3f56e2..78888c360f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,22 +10,22 @@ [dev] # local development with the Netlify CLI - command = "make serve" + command = "bash ./scripts/local-server.sh" targetPort = 1313 port = 8000 [context.production] - command = "make bundle; hugo --gc --minify --enableGitInfo" + command = "bash ./scripts/netlify-deploy-production.sh" [context.production.environment] HUGO_ENV = "production" [context.deploy-preview] - command = "make bundle; hugo --gc --minify --enableGitInfo --buildFuture" + command = "bash ./scripts/netlify-deploy-preview.sh" [context.deploy-preview.environment] HUGO_ENV = "staging" [context.branch-deploy] - command = "make bundle; hugo --gc --minify --enableGitInfo" + command = "bash ./scripts/netlify-branch-deploy.sh" [context.branch-deploy.environment] HUGO_ENV = "branch-deploy" diff --git a/scripts/local-server.sh b/scripts/local-server.sh new file mode 100644 index 0000000000..df899314f8 --- /dev/null +++ b/scripts/local-server.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -eou pipefail + +### +# Local deploy preview using Netlify CLI +# https://docs.netlify.com/cli/get-started/ +# Run 'netlify dev' +### + +pushd themes/docs-new && npm install && popd +hugo server -b localhost:1313 diff --git a/scripts/netlify-branch-deploy.sh b/scripts/netlify-branch-deploy.sh new file mode 100644 index 0000000000..968463391d --- /dev/null +++ b/scripts/netlify-branch-deploy.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eou pipefail + +### +# Generate Netlify branch builds +# https://docs.netlify.com/site-deploys/overview/#branches-and-deploys +### + +echo Branch: $HEAD +echo Branch deploy URL: $DEPLOY_PRIME_URL + +pushd themes/docs-new && npm install && popd +hugo --gc --minify --enableGitInfo diff --git a/scripts/netlify-deploy-preview.sh b/scripts/netlify-deploy-preview.sh new file mode 100644 index 0000000000..9278409577 --- /dev/null +++ b/scripts/netlify-deploy-preview.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eou pipefail + +### +# Generate Netlify build previews for a pull request +# https://docs.netlify.com/site-deploys/overview/#branches-and-deploys +### + +echo Branch: $HEAD +echo Branch deploy URL: $DEPLOY_PRIME_URL + +pushd themes/docs-new && npm install && popd +hugo --gc --minify --enableGitInfo --buildFuture diff --git a/scripts/netlify-deploy-production.sh b/scripts/netlify-deploy-production.sh new file mode 100644 index 0000000000..c868b73ff4 --- /dev/null +++ b/scripts/netlify-deploy-production.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eou pipefail + +### +# Generate Netlify production builds +# https://docs.netlify.com/site-deploys/overview/#branches-and-deploys +### + +echo Branch: $HEAD +echo Branch deploy URL: $DEPLOY_PRIME_URL + +pushd themes/docs-new && npm install && popd +hugo --gc --minify --enableGitInfo