Skip to content

Commit

Permalink
Sort tags better
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari committed Nov 1, 2023
1 parent 789b15a commit 002f62e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions docs/plugins/latest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"golang.org/x/mod/semver"
"io"
"os"
"strings"
)

func main() {
bs, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}

var latest string
for _, ver := range strings.Split(string(bs), "\n") {
if latest == "" {
latest = ver
continue
}
if semver.Compare(latest, ver) < 0 {
latest = ver
}
}
println(latest)
}
2 changes: 1 addition & 1 deletion docs/plugins/lint_plugin_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ URL_PREFIX="https://github.com/please-build/"

failed=0
for plugin in "${PLUGINS[@]}"; do
latest=$(git ls-remote --tags "${URL_PREFIX}""${plugin}"-rules.git | sed 's/.*\///' | sed '/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/!d' | tail -n 1)
latest=$(git ls-remote --tags --sort=version:refname "${URL_PREFIX}""${plugin}"-rules.git | sed 's/.*\///' | sed '/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/!d' | tail -n 1)
if [ -z "$latest" ]; then
echo "No tags found for ${plugin}"
exit 1
Expand Down

0 comments on commit 002f62e

Please sign in to comment.