From 169f31e7d88b14795294bdbaf9a173e89929f82d Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 24 Mar 2023 12:29:04 +0000 Subject: [PATCH 1/2] Add `deps-docs` command to makefile Refactored `deps-docs` out of `docs` because `#23629` broke Gitpod's docs setup (which grepped to get the hugo install command). --- .gitpod.yml | 2 +- Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 506c620458354..a165203b34010 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -24,7 +24,7 @@ tasks: make watch-frontend openMode: split-right - name: Run docs - before: sudo bash -c "$(grep 'https://github.com/gohugoio/hugo/releases/download' Makefile | tr -d '\')" # install hugo + before: sudo make deps-docs command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0 openMode: split-right diff --git a/Makefile b/Makefile index 462bb657cc423..63b5656f275e1 100644 --- a/Makefile +++ b/Makefile @@ -189,6 +189,7 @@ help: @echo " - clean delete backend and integration files" @echo " - clean-all delete backend, frontend and integration files" @echo " - deps install dependencies" + @echo " - deps-docs install docs dependencies" @echo " - deps-frontend install frontend dependencies" @echo " - deps-backend install backend dependencies" @echo " - deps-tools install tool dependencies" @@ -816,11 +817,14 @@ release-docs: | $(DIST_DIRS) docs tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public . .PHONY: docs -docs: +docs: deps-docs + cd docs; make trans-copy clean build-offline; + +.PHONY: deps-docs # TODO: find a way to install hugo without needing sudo permissions and add deps-docs to deps (the next block) +deps-docs: @hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \ fi - cd docs; make trans-copy clean build-offline; .PHONY: deps deps: deps-frontend deps-backend deps-tools From 3566296815df6215fc9ee190115fad56e7cb2e1d Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 24 Mar 2023 12:55:13 +0000 Subject: [PATCH 2/2] Use `~/go/bin` --- .gitpod.yml | 7 +++++-- Makefile | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index a165203b34010..39f62435de77a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -24,8 +24,11 @@ tasks: make watch-frontend openMode: split-right - name: Run docs - before: sudo make deps-docs - command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0 + command: | + gp sync-await setup + cd docs + make clean update + hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0 openMode: split-right vscode: diff --git a/Makefile b/Makefile index 63b5656f275e1..5538c01d3d00b 100644 --- a/Makefile +++ b/Makefile @@ -820,14 +820,14 @@ release-docs: | $(DIST_DIRS) docs docs: deps-docs cd docs; make trans-copy clean build-offline; -.PHONY: deps-docs # TODO: find a way to install hugo without needing sudo permissions and add deps-docs to deps (the next block) +.PHONY: deps-docs deps-docs: @hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ - curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \ + curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo ~/go/bin/hugo && chmod +x ~/go/bin/hugo; \ fi .PHONY: deps -deps: deps-frontend deps-backend deps-tools +deps: deps-frontend deps-backend deps-tools deps-docs .PHONY: deps-frontend deps-frontend: node_modules