-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate update manifest during build
- Loading branch information
Showing
4 changed files
with
70 additions
and
5 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
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,39 @@ | ||
// Copyright (c) 2023 Gitpod GmbH. All rights reserved. | ||
// Licensed under the GNU Affero General Public License (AGPL). | ||
// See License.AGPL.txt in the project root for license information. | ||
|
||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/Masterminds/semver/v3" | ||
"github.com/gitpod-io/local-app/pkg/constants" | ||
"github.com/gitpod-io/local-app/pkg/selfupdate" | ||
"github.com/sagikazarmark/slog-shim" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
var ( | ||
version = pflag.String("version", constants.Version.String(), "version to use") | ||
cwd = pflag.String("cwd", ".", "working directory") | ||
) | ||
|
||
func main() { | ||
pflag.Parse() | ||
|
||
ver := semver.MustParse(*version) | ||
mf, err := selfupdate.GenerateManifest(ver, *cwd, selfupdate.DefaultFilenameParser) | ||
if err != nil { | ||
slog.Error("cannot generate manifest", "err", err) | ||
os.Exit(1) | ||
} | ||
fc, err := json.MarshalIndent(mf, "", " ") | ||
if err != nil { | ||
slog.Error("cannot marshal manifest", "err", err) | ||
os.Exit(1) | ||
} | ||
fmt.Println(string(fc)) | ||
} |
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
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