Skip to content

Commit

Permalink
fix: add environment separation for development and archived branches
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente J. Jiménez Miras <vjjmiras@gmail.com>
  • Loading branch information
vjjmiras authored and poiana committed Oct 12, 2023
1 parent b7b1a53 commit d980430
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
ifndef DEPLOY_PRIME_URL
override DEPLOY_PRIME_URL = localhost
endif

ifndef HUGO_ENV
override HUGO_ENV = development
endif

clean:
rm -rf public

Expand All @@ -11,16 +19,25 @@ serve: dependencies

production-build: dependencies
make check-github-rate-limit
hugo --minify
hugo --minify --environment $(HUGO_ENV)
make check-links

branch-build: dependencies
make check-github-rate-limit
hugo \
--minify \
--environment $(HUGO_ENV) \
--baseURL $(DEPLOY_PRIME_URL)
make check-links

preview-build: dependencies
make check-github-rate-limit
hugo \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
--buildFuture \
--minify
--minify \
--environment $(HUGO_ENV) \
--baseURL $(DEPLOY_PRIME_URL)
make check-links

link-checker-setup:
Expand Down
6 changes: 4 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"

[context.deploy-preview]
HUGO_ENV = "development"
command = "make preview-build"

[context.branch-deploy]
command = "make preview-build"
HUGO_ENV = "archive"
command = "make branch-build"

[functions]
node_bundler = "esbuild"
node_bundler = "esbuild"

0 comments on commit d980430

Please sign in to comment.