Update 10212024@1540
This commit is contained in:
parent
7c1b81ec92
commit
d03ef47489
26
main.go
26
main.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@ -9,6 +10,10 @@ import (
|
||||
"code.gitea.io/sdk/gitea"
|
||||
)
|
||||
|
||||
type VersionInfo struct {
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
client, err := createGiteaClient()
|
||||
if err != nil {
|
||||
@ -20,6 +25,10 @@ func main() {
|
||||
log.Fatalf("VERSION environment variable is not set")
|
||||
}
|
||||
|
||||
if err := updateVersionFile(version); err != nil {
|
||||
log.Fatalf("Error updating version file: %v", err)
|
||||
}
|
||||
|
||||
repoOwner := "IDSolutions"
|
||||
repoName := "mod"
|
||||
|
||||
@ -36,7 +45,22 @@ func main() {
|
||||
log.Fatalf("Error uploading release asset: %v", err)
|
||||
}
|
||||
|
||||
fmt.Println("Release created and artifact uploaded successfully!")
|
||||
fmt.Println("Release created, artifact uploaded, and version file updated successfully!")
|
||||
}
|
||||
|
||||
func updateVersionFile(version string) error {
|
||||
versionInfo := VersionInfo{Version: version}
|
||||
jsonData, err := json.MarshalIndent(versionInfo, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error marshaling version info: %w", err)
|
||||
}
|
||||
|
||||
err = os.WriteFile("pmcs_mod_version.json", jsonData, 0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error writing version file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func createGiteaClient() (*gitea.Client, error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user