Compare commits

..

No commits in common. "d7bd0b92bb3095afc7c5098e65081ac79c0c6789" and "37a798d27297f7b82d75ac1e3c9545718757ccab" have entirely different histories.

28
main.go
View File

@ -1,7 +1,6 @@
package main
import (
"encoding/json"
"fmt"
"log"
"os"
@ -10,10 +9,6 @@ import (
"code.gitea.io/sdk/gitea"
)
type VersionInfo struct {
Version string `json:"version"`
}
func main() {
client, err := createGiteaClient()
if err != nil {
@ -25,10 +20,6 @@ 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"
@ -45,22 +36,7 @@ func main() {
log.Fatalf("Error uploading release asset: %v", err)
}
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
fmt.Println("Release created and artifact uploaded successfully!")
}
func createGiteaClient() (*gitea.Client, error) {
@ -89,4 +65,4 @@ func uploadArtifact(client *gitea.Client, owner, repo string, releaseID int64, a
_, _, err = client.CreateReleaseAttachment(owner, repo, releaseID, file, filepath.Base(artifactPath))
return err
}
}