Skip to content

Commit

Permalink
Makefile: replace build-docs by generate
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajolet-hashicorp committed Nov 24, 2023
1 parent 65f5224 commit c3ec1bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ensure-docs-compiled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-go@v4
- shell: bash
run: make build-docs
run: make generate
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make build-docs', and commit the result to resolve this error."
echo "Run 'make generate', and commit the result to resolve this error."
exit 1
fi
15 changes: 4 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GOBIN=$(shell go env GOBIN)
endif

PACKER_SDC=$(GOBIN)/packer-sdc
PACKER_SDC_RENDER_DOCS=$(PACKER_SDC) renderdocs -src docs-src/ -partials docs-partials/ -dst docs/
PACKER_SDC_RENDER_DOCS=$(PACKER_SDC) renderdocs -src docs-src/ -partials docs-partials/ -dst .docs/


default: build
Expand All @@ -36,16 +36,15 @@ install: build
install-packer-sdc: ## Install packer sofware development command
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@$(HASHICORP_PACKER_PLUGIN_SDK_VERSION)

ci-release-docs: install-packer-sdc generate
@/bin/sh -c "[ -d docs ] && zip -x docs/README.mdx -r docs.zip docs/"

plugin-check: install-packer-sdc build
$(PACKER_SDC) plugin-check $(BINARY)

generate: fmt install-packer-sdc
@PATH=$(PATH):$(GOBIN) go generate ./...
@rm -fr $(CURDIR)/docs # renderdocs doesn't seem to properly overwrite files
@if [ -d ".docs" ]; then rm -r ".docs"; fi
$(PACKER_SDC_RENDER_DOCS)
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "UpCloudLtd"
@rm -r ".docs"

fmt:
packer fmt builder/upcloud/test-fixtures/hcl2
Expand All @@ -57,10 +56,4 @@ clean:
find . -name "TestBuilderAcc_*" -delete
find . -name "packer-plugin-upcloud" -delete

build-docs: install-packer-sdc
@if [ -d ".docs" ]; then rm -r ".docs"; fi
@packer-sdc renderdocs -src "docs" -partials docs-partials/ -dst ".docs/"
@./.web-docs/scripts/compile-to-webdocs.sh "." ".docs" ".web-docs" "UpCloudLtd"
@rm -r ".docs"

.PHONY: default test test_integration lint build install build-docs

0 comments on commit c3ec1bb

Please sign in to comment.