Skip to content

Commit

Permalink
Deploy using sh scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Maddaus <[email protected]>
  • Loading branch information
IanMadd committed Mar 20, 2024
1 parent 8bec439 commit cc3d8c9
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.DS_Store

# Hugo/Go workspace files
*.work
*.work.sum

# ignore doctree files in translation folders
*.doctree
*.pickle
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
12 changes: 12 additions & 0 deletions scripts/local-server.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions scripts/netlify-branch-deploy.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions scripts/netlify-deploy-preview.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions scripts/netlify-deploy-production.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cc3d8c9

Please sign in to comment.