opentofu/Makefile
Kevin Wang 2563bf3f96
feat: support local preview, post split; add deploy preview (#30814)
* chore: support local preview, post split

* feat: deploy preview

* update script perms
- chmod +x ./website/scripts/website-build.sh

* npm i

* chore: website-build uses 'kevin/terraform-split'

* deploy preview test

* chore: test

* PREVIEW_DIR & CLONE_DIR = preview

* rm dupe preview path

* empty commit

* ../data & ..docs

* website-preview

* remove REPO var

* move `intro` and `guides` back to where they were

* empty commit

* chore move `intro` and `guides`

* chore: copy over images

* move images into `/website`
- content API requires this

* chore: `CURRENT_GIT_BRANCH`

* fix: `CURRENT_GIT_BRANCH`

* fix `CURRENT_GIT_BRANCH`

* debug current dir

* fix `CURRENT_GIT_BRANCH`

* chore: comment CURRENT_GIT_BRANCH

* Update Makefile

* Update website/scripts/website-build.sh

* optimize images

* chore(Makefile): move vars to top

* remove branch
2022-04-21 13:58:16 -04:00

67 lines
2.2 KiB
Makefile

WEBSITE_REPO=github.com/hashicorp/terraform-website
VERSION?="0.3.44"
PWD=$$(pwd)
DOCKER_IMAGE="hashicorp/terraform-website:full"
DOCKER_IMAGE_LOCAL="hashicorp-terraform-website-local"
DOCKER_RUN_FLAGS=--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website/ext/terraform" \
--volume "$(shell pwd)/website:/website/preview" \
--publish "3000:3000" \
-e "IS_CONTENT_PREVIEW=true" \
-e "PREVIEW_FROM_REPO=terraform" \
-e "NAV_DATA_DIRNAME=./preview/data" \
-e "CONTENT_DIRNAME=./preview/docs" \
-e "CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)"
# generate runs `go generate` to build the dynamically generated
# source files, except the protobuf stubs which are built instead with
# "make protobuf".
generate:
go generate ./...
# We separate the protobuf generation because most development tasks on
# Terraform do not involve changing protobuf files and protoc is not a
# go-gettable dependency and so getting it installed can be inconvenient.
#
# If you are working on changes to protobuf interfaces, run this Makefile
# target to be sure to regenerate all of the protobuf stubs using the expected
# versions of protoc and the protoc Go plugins.
protobuf:
go run ./tools/protobuf-compile .
fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
staticcheck:
@sh -c "'$(CURDIR)/scripts/staticcheck.sh'"
exhaustive:
@sh -c "'$(CURDIR)/scripts/exhaustive.sh'"
# Default: run this if working on the website locally to run in watch mode.
website:
@echo "==> Downloading latest Docker image..."
@docker pull ${DOCKER_IMAGE}
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE} npm start
website/local:
@echo "==> Starting website in Docker..."
@docker run ${DOCKER_RUN_FLAGS} ${DOCKER_IMAGE_LOCAL} npm start
.PHONY: website/build-local
website/build-local:
@echo "==> Building local Docker image"
@docker build https://github.com/hashicorp/terraform-website.git\#master \
-t $(DOCKER_IMAGE_LOCAL)
# disallow any parallelism (-j) for Make. This is necessary since some
# commands during the build process create temporary files that collide
# under parallel conditions.
.NOTPARALLEL:
.PHONY: fmtcheck generate protobuf website website-test staticcheck website/local website/build-local