Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release version on Agones website #3338

Merged
merged 5 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build/includes/website.mk
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,9 @@ del-data-proofer-ignore: ensure-build-image
site-config-update-version: ensure-build-image
docker run --rm $(common_mounts) --workdir=$(mount_path) $(DOCKER_RUN_ARGS) $(build_tag) \
go run build/scripts/site-config-update-version/main.go

# Delete old release version in site/layouts/partials/navbar.html.
update-navbar-version: FILENAME ?= ""
update-navbar-version: ensure-build-image
docker run --rm $(common_mounts) --workdir=$(mount_path) $(DOCKER_RUN_ARGS) $(build_tag) \
go run build/scripts/update-navbar-version/main.go -file=$(FILENAME)
69 changes: 69 additions & 0 deletions build/scripts/update-navbar-version/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2023 Google LLC All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// The main package implements a program that removes the old version of the link in `navbarDropdownMenuLink` found in the `site/layouts/partials/navbar.html` file
package main

import (
"flag"
"log"
"os"
"regexp"
"strings"
)

func removeLastDropdownItem(input string) string {
re := regexp.MustCompile(`(?s)(<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">)(.*?)(</div>)`)
matches := re.FindStringSubmatch(input)

// Determine the indentation before the <div>
divStartPos := strings.Index(input, matches[1])
divIndentation := ""
for i := divStartPos - 1; i >= 0 && (input[i] == ' ' || input[i] == '\t'); i-- {
divIndentation = string(input[i]) + divIndentation
}

// Split links inside the dropdown
links := strings.Split(matches[2], "</a>")

updatedLinks := strings.Join(links[:len(links)-2], "</a>") + "</a>\n" + divIndentation

return strings.Replace(input, matches[2], updatedLinks, 1)
}

func main() {
filePath := flag.String("file", "", "HTML File Path")
flag.Parse()

if *filePath == "" {
log.Println("Please provide the path to the HTML file using the FILENAME flag.")
return
}

content, err := os.ReadFile(*filePath)
if err != nil {
log.Println("Error reading the file:", err)
return
}

updatedContent := removeLastDropdownItem(string(content))

err = os.WriteFile(*filePath, []byte(updatedContent), 0o644)
if err != nil {
log.Println("Error writing to the file:", err)
return
}

log.Println("Successfully updated the file.")
}
2 changes: 1 addition & 1 deletion docs/governance/templates/release_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ and copy it into a release issue. Fill in relevant values, found inside {}
- [ ] In `site/content/en/docs/Installation/_index.md #agones-and-kubernetes-supported-versions`, for the current version, replace `{{% k8s-version %}}` with hardcoded Kubernetes versions supported by the current version. And add a row for the Agones release version with `{{% k8s-version %}}` as its supported Kubernetes versions.
- [ ] Run `make del-data-proofer-ignore FILENAME={version}-1.md` to remove `data-proofer-ignore` attribute from previous release blog. Review all occurrences of the link_test and data-proofer-ignore attributes globally. Exclude html and release files.
- [ ] Run `make feature-shortcode-update version={version}` to remove all instances of the `feature expiryVersion` shortcode, including the associated content, while preserving the rest of the content within the .md files located in site/content/en/docs. Additionally, ensure that only the block of `feature publishVersion` is removed without affecting the content.
- [ ] Add a link to previous version's documentation to nav dropdown in `site/layouts/partials/navbar.html`
- [ ] Add a link to previous version's documentation to nav dropdown in `site/layouts/partials/navbar.html` on top and Run `make update-navbar-version FILENAME=site/layouts/partials/navbar.html` to remove the older version from the dropdown list.
- [ ] config.toml updates:
- [ ] Run `make site-config-update-version` to update the release version and sync data between dev and prod.
- [ ] Update documentation with updated example images tags.
Expand Down
17 changes: 0 additions & 17 deletions site/layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,6 @@
<a class="dropdown-item" href="https://1-19-0.agones.dev">1.19.0</a>
<a class="dropdown-item" href="https://1-18-0.agones.dev">1.18.0</a>
<a class="dropdown-item" href="https://1-17-0.agones.dev">1.17.0</a>
<a class="dropdown-item" href="https://1-16-0.agones.dev">1.16.0</a>
<a class="dropdown-item" href="https://1-15-0.agones.dev">1.15.0</a>
<a class="dropdown-item" href="https://1-14-0.agones.dev">1.14.0</a>
<a class="dropdown-item" href="https://1-13-0.agones.dev">1.13.0</a>
<a class="dropdown-item" href="https://1-12-0.agones.dev">1.12.0</a>
<a class="dropdown-item" href="https://1-11-0.agones.dev">1.11.0</a>
<a class="dropdown-item" href="https://1-10-0.agones.dev">1.10.0</a>
<a class="dropdown-item" href="https://1-9-0.agones.dev">1.9.0</a>
<a class="dropdown-item" href="https://1-8-0.agones.dev">1.8.0</a>
<a class="dropdown-item" href="https://1-7-0.agones.dev">1.7.0</a>
<a class="dropdown-item" href="https://1-6-0.agones.dev">1.6.0</a>
<a class="dropdown-item" href="https://1-5-0.agones.dev">1.5.0</a>
<a class="dropdown-item" href="https://1-4-0.agones.dev">1.4.0</a>
<a class="dropdown-item" href="https://1-3-0.agones.dev">1.3.0</a>
<a class="dropdown-item" href="https://1-2-0.agones.dev">1.2.0</a>
<a class="dropdown-item" href="https://1-1-0.agones.dev">1.1.0</a>
<a class="dropdown-item" href="https://1-0-0.agones.dev">1.0.0</a>
</div>
</li>
{{ if (gt (len .Site.Home.Translations) 0) }}
Expand Down
Loading