From 110974689df86de726cfc02ac4281c6b4e94fa1a Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Thu, 1 Dec 2022 08:59:17 -0700 Subject: [PATCH 1/2] Handle detached HEAD on tagged release. --- lattice/docs/hugo_web.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lattice/docs/hugo_web.py b/lattice/docs/hugo_web.py index 67ac821..d88728d 100644 --- a/lattice/docs/hugo_web.py +++ b/lattice/docs/hugo_web.py @@ -72,7 +72,10 @@ def get_git_info(self): self.git_repo_name = git_url_parts[-1] self.git_repo_owner = git_url_parts[-2] self.git_repo_host = os.path.splitext(git_url_parts[-3])[0] - self.git_branch_name = self.git_repo.active_branch.name + if self.git_repo.head.is_detached: + self.git_ref_name = "main" + else: + self.git_ref_name = self.git_repo.head.ref.name self.base_url = fr"https://{self.git_repo_owner}.{self.git_repo_host}.io/{self.git_repo_name}/" def make_pages(self): @@ -285,7 +288,7 @@ def make_hugo_config(self): "params": { "copyright": self.author, "github_repo": self.git_remote_url, - "github_branch": self.git_branch_name, + "github_branch": self.git_ref_name, "ui": { "navbar_logo": self.has_logo, "breadcrumb_disable": True From ba098f3339ac49fe729b20475e5177b0d645ab7a Mon Sep 17 00:00:00 2001 From: Neal Kruis Date: Thu, 1 Dec 2022 09:05:55 -0700 Subject: [PATCH 2/2] Only build web-docs on release. --- .github/workflows/build-web.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-web.yaml b/.github/workflows/build-web.yaml index c1c4a04..7593085 100644 --- a/.github/workflows/build-web.yaml +++ b/.github/workflows/build-web.yaml @@ -1,6 +1,9 @@ name: Web Documentation -on: push +on: + release: + types: + - created jobs: build: