mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 19:54:10 -06:00
Check if dist dir exists (#54590)
This commit is contained in:
parent
59ba64f29b
commit
212f0609eb
@ -81,16 +81,18 @@ func GenerateVersions(c *cli.Context) error {
|
||||
}
|
||||
|
||||
const distDir = "dist"
|
||||
if err := os.RemoveAll(distDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Mkdir(distDir, 0750); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := os.Stat(distDir); os.IsNotExist(err) {
|
||||
if err := os.RemoveAll(distDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Mkdir(distDir, 0750); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// nolint:gosec
|
||||
if err := os.WriteFile(filepath.Join(distDir, "version.json"), jsonMetadata, 0664); err != nil {
|
||||
return err
|
||||
// nolint:gosec
|
||||
if err := os.WriteFile(filepath.Join(distDir, "version.json"), jsonMetadata, 0664); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user