-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package update | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/equinox-io/equinox" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var Cmd = &cobra.Command{ | ||
Use: "update", | ||
Short: "Update to the latest release", | ||
|
||
Args: cobra.ExactArgs(0), | ||
|
||
Run: update, | ||
} | ||
|
||
// assigned when creating a new application in the dashboard | ||
const appID = "app_gCwJN1DfmYU" | ||
|
||
// public portion of signing key generated by `equinox genkey` | ||
var publicKey = []byte(` | ||
-----BEGIN ECDSA PUBLIC KEY----- | ||
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEHk9AJl154cKxZRECl5oO7GaAAM4Rc5e4 | ||
rBytsXGhOWeZdv/QGXWO3gPq134sTFeOwNwu6GJdk1QhAw85YQc/RKFf2vm2Jut4 | ||
Ad3Me5ph2iwXmgG3tPvBNthqeQgIu58f | ||
-----END ECDSA PUBLIC KEY----- | ||
`) | ||
|
||
func update(cmd *cobra.Command, args []string) { | ||
var opts equinox.Options | ||
if err := opts.SetPublicKeyPEM(publicKey); err != nil { | ||
log.Fatalf("%v", err) | ||
} | ||
|
||
// check for the update | ||
resp, err := equinox.Check(appID, opts) | ||
switch { | ||
case err == equinox.NotAvailableErr: | ||
fmt.Println("No update available, already at the latest version!") | ||
log.Fatalf("%v", err) | ||
case err != nil: | ||
fmt.Println("Update failed:", err) | ||
log.Fatalf("%v", err) | ||
} | ||
|
||
// fetch the update and apply it | ||
err = resp.Apply() | ||
if err != nil { | ||
log.Fatalf("%v", err) | ||
} | ||
|
||
fmt.Printf("Updated to new version: %s!\n", resp.ReleaseVersion) | ||
return | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
equinox release \ | ||
--version=$(git describe --tags) \ | ||
--platforms="darwin_amd64 darwin_arm64 linux_arm linux_arm64 linux_amd64 windows_amd64 windows_arm64" \ | ||
--signing-key=${EQUINOX_KEY} \ | ||
--app="app_gCwJN1DfmYU" \ | ||
--token="${EQUINOX_TOKEN}" \ | ||
go.transparencylog.net/tl |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.