grafana/pkg/build/cmd/exportversion.go
Dimitris Sotirakis f73cdc5e80
Metadata: Move and rename genversions.go and genversions_test.go (#60315)
* Move and rename genversions.go and tests

* Fix lint - bring back cli.Exit

* Move package.json and fix tests

* Add necessary env vars for promote event
2022-12-15 03:51:11 -05:00

32 lines
568 B
Go

package main
import (
"os"
"path/filepath"
"github.com/grafana/grafana/pkg/build/config"
"github.com/urfave/cli/v2"
)
func ExportVersion(c *cli.Context) error {
metadata, err := config.GenerateMetadata(c)
if err != nil {
return err
}
const distDir = "dist"
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, "grafana.version"), []byte(metadata.GrafanaVersion), 0664); err != nil {
return err
}
return nil
}