feat: write used latest Unifi version to .unifi-version file to be used as marker
This commit is contained in:
@@ -87,5 +87,12 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
workingDir, _ := os.Getwd()
|
||||
basepath := filepath.Dir(workingDir)
|
||||
if err = writeVersionRepoMarkerFile(unifiVersion.Version, basepath); err != nil {
|
||||
log.Fatalf("failed to write version file to %s", basepath)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Infof("Generated resources in %s", outDir)
|
||||
}
|
||||
|
||||
@@ -104,3 +104,8 @@ const UnifiVersion = %q
|
||||
|
||||
return os.WriteFile(filepath.Join(outDir, "version.generated.go"), versionGo, 0o644)
|
||||
}
|
||||
|
||||
func writeVersionRepoMarkerFile(version *version.Version, outDir string) error {
|
||||
versionRepoMarker := []byte(fmt.Sprintf(`%s`, version.Core()))
|
||||
return os.WriteFile(filepath.Join(outDir, ".unifi-version"), versionRepoMarker, 0o644)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user