File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "fmt"
45 "os"
56 "path/filepath"
67 "regexp"
@@ -12,6 +13,7 @@ import (
1213 "github.com/code-game-project/go-utils/cgfile"
1314 "github.com/code-game-project/go-utils/cggenevents"
1415 "github.com/code-game-project/go-utils/exec"
16+ "github.com/code-game-project/go-utils/external"
1517 "github.com/code-game-project/go-utils/modules"
1618 "github.com/code-game-project/go-utils/server"
1719)
@@ -36,6 +38,14 @@ func CreateNewClient(projectName string) error {
3638 return err
3739 }
3840
41+ if data .LibraryVersion == "latest" {
42+ data .LibraryVersion , err = external .LatestGithubTag ("code-game-project" , "java-client" )
43+ data .LibraryVersion = strings .TrimPrefix (data .LibraryVersion , "v" )
44+ if err != nil {
45+ return fmt .Errorf ("Failed to determine latest library version: %w" , err )
46+ }
47+ }
48+
3949 api , err := server .NewAPI (data .URL )
4050 if err != nil {
4151 return err
Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ package main
33import (
44 "errors"
55 "fmt"
6+ "strings"
67
78 "github.com/Bananenpro/cli"
89 "github.com/code-game-project/go-utils/cgfile"
910 "github.com/code-game-project/go-utils/cggenevents"
1011 "github.com/code-game-project/go-utils/exec"
12+ "github.com/code-game-project/go-utils/external"
1113 "github.com/code-game-project/go-utils/modules"
1214 "github.com/code-game-project/go-utils/server"
1315)
@@ -22,6 +24,15 @@ func Update(projectName string) error {
2224 if err != nil {
2325 return err
2426 }
27+
28+ if data .LibraryVersion == "latest" {
29+ data .LibraryVersion , err = external .LatestGithubTag ("code-game-project" , "java-client" )
30+ data .LibraryVersion = strings .TrimPrefix (data .LibraryVersion , "v" )
31+ if err != nil {
32+ return fmt .Errorf ("Failed to determine latest library version: %w" , err )
33+ }
34+ }
35+
2536 switch config .Type {
2637 case "client" :
2738 return updateClient (projectName , data .LibraryVersion , config )
You can’t perform that action at this time.
0 commit comments