-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: add generate_release_info tool
- Loading branch information
Showing
2 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"flag" | ||
"html/template" | ||
"os" | ||
"sort" | ||
"strings" | ||
) | ||
|
||
//go:embed release-description-template.md | ||
var releaseDescriptionTemplate string | ||
|
||
func main() { | ||
var buildPath string | ||
flag.StringVar(&buildPath, "build_path", "build", "directory with build files") | ||
|
||
files, err := os.ReadDir(buildPath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
var awlAndroid string | ||
var awlLinux []string | ||
var awlWindows []string | ||
var awlTrayLinux []string | ||
var awlTrayWindows []string | ||
|
||
for _, file := range files { | ||
if file.IsDir() { | ||
continue | ||
} | ||
filename := file.Name() | ||
|
||
switch { | ||
case strings.HasPrefix(filename, "awl-android"): | ||
awlAndroid = filename | ||
case strings.HasPrefix(filename, "awl-linux"): | ||
awlLinux = append(awlLinux, filename) | ||
case strings.HasPrefix(filename, "awl-windows"): | ||
awlWindows = append(awlWindows, filename) | ||
case strings.HasPrefix(filename, "awl-tray-linux"): | ||
awlTrayLinux = append(awlTrayLinux, filename) | ||
case strings.HasPrefix(filename, "awl-tray-windows"): | ||
awlTrayWindows = append(awlTrayWindows, filename) | ||
} | ||
} | ||
|
||
sort.Strings(awlLinux) | ||
sort.Strings(awlWindows) | ||
sort.Strings(awlTrayLinux) | ||
sort.Strings(awlTrayWindows) | ||
|
||
releaseTag := strings.TrimPrefix(awlAndroid, "awl-android-") | ||
releaseTag = strings.TrimSuffix(releaseTag, ".apk") | ||
|
||
temp, err := template.New("release-description").Parse(releaseDescriptionTemplate) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
data := map[string]interface{}{ | ||
"ReleaseTag": releaseTag, | ||
"AwlAndroid": awlAndroid, | ||
"AwlLinux": awlLinux, | ||
"AwlWindows": awlWindows, | ||
"AwlTrayLinux": awlTrayLinux, | ||
"AwlTrayWindows": awlTrayWindows, | ||
} | ||
|
||
err = temp.Execute(os.Stdout, data) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Installation | ||
|
||
For instructions on how to install anywherelan [see readme](https://github.com/anywherelan/awl#installation). | ||
|
||
## Android | ||
|
||
[{{$.AwlAndroid}}](https://github.com/anywherelan/awl/releases/download/{{$.ReleaseTag}}/{{$.AwlAndroid}}) | ||
|
||
## Desktop version (awl-tray) | ||
|
||
### Linux binary builds | ||
|
||
{{range .AwlTrayLinux}} | ||
[{{.}}](https://github.com/anywherelan/awl/releases/download/{{$.ReleaseTag}}/{{.}}) {{end}} | ||
|
||
### Windows binary builds | ||
|
||
{{range .AwlTrayWindows}} | ||
[{{.}}](https://github.com/anywherelan/awl/releases/download/{{$.ReleaseTag}}/{{.}}) {{end}} | ||
|
||
## Server version (awl) | ||
|
||
### Linux binary builds | ||
|
||
{{range .AwlLinux}} | ||
[{{.}}](https://github.com/anywherelan/awl/releases/download/{{$.ReleaseTag}}/{{.}}) {{end}} | ||
|
||
### Windows binary builds | ||
|
||
{{range .AwlWindows}} | ||
[{{.}}](https://github.com/anywherelan/awl/releases/download/{{$.ReleaseTag}}/{{.}}) {{end}} |