node build fixed
This commit is contained in:
57
seanime-2.9.10/.github/scripts/generate_release_notes.go
vendored
Normal file
57
seanime-2.9.10/.github/scripts/generate_release_notes.go
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
const inFile = "CHANGELOG.md"
|
||||
const outFile = "whats-new.md"
|
||||
|
||||
// Get the path to the changelog
|
||||
changelogPath := filepath.Join(".", inFile)
|
||||
|
||||
// Read the changelog content
|
||||
content, err := os.ReadFile(changelogPath)
|
||||
if err != nil {
|
||||
fmt.Println("Error reading changelog:", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Convert the content to a string
|
||||
changelog := string(content)
|
||||
|
||||
// Extract everything between the first and second "## " headers
|
||||
sections := strings.Split(changelog, "## ")
|
||||
if len(sections) < 2 {
|
||||
fmt.Println("Not enough headers found in the changelog.")
|
||||
return
|
||||
}
|
||||
|
||||
// We only care about the first section
|
||||
changelog = sections[1]
|
||||
|
||||
// Remove everything after the next header (if any)
|
||||
changelog = strings.Split(changelog, "## ")[0]
|
||||
|
||||
// Remove the first line (which is the title of the first section)
|
||||
lines := strings.Split(changelog, "\n")
|
||||
if len(lines) > 1 {
|
||||
changelog = strings.Join(lines[1:], "\n")
|
||||
}
|
||||
|
||||
// Trim newlines
|
||||
changelog = strings.TrimSpace(changelog)
|
||||
|
||||
// Write the extracted content to the output file
|
||||
outPath := filepath.Join(".", outFile)
|
||||
if err := os.WriteFile(outPath, []byte(changelog), 0644); err != nil {
|
||||
fmt.Println("Error writing to file:", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Changelog content written to %s\n", outPath)
|
||||
}
|
||||
107
seanime-2.9.10/.github/scripts/generate_updater_latest.go
vendored
Normal file
107
seanime-2.9.10/.github/scripts/generate_updater_latest.go
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
DownloadUrl = "https://github.com/5rahim/seanime/releases/latest/download/"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Retrieve version from environment variable
|
||||
version := os.Getenv("APP_VERSION")
|
||||
if version == "" {
|
||||
version = "1.0.0" // Default to '1.0.0' if not set
|
||||
}
|
||||
|
||||
// Define the asset filenames
|
||||
assets := map[string]struct {
|
||||
Asset string
|
||||
AppZip string
|
||||
Sig string
|
||||
}{
|
||||
"MacOS_arm64": {
|
||||
Asset: fmt.Sprintf("seanime-desktop-%s_MacOS_arm64.app.tar.gz", version),
|
||||
Sig: fmt.Sprintf("seanime-desktop-%s_MacOS_arm64.app.tar.gz.sig", version),
|
||||
},
|
||||
"MacOS_x86_64": {
|
||||
Asset: fmt.Sprintf("seanime-desktop-%s_MacOS_x86_64.app.tar.gz", version),
|
||||
Sig: fmt.Sprintf("seanime-desktop-%s_MacOS_x86_64.app.tar.gz.sig", version),
|
||||
},
|
||||
"Linux_x86_64": {
|
||||
Asset: fmt.Sprintf("seanime-desktop-%s_Linux_x86_64.AppImage", version),
|
||||
Sig: fmt.Sprintf("seanime-desktop-%s_Linux_x86_64.AppImage.sig", version),
|
||||
},
|
||||
"Windows_x86_64": {
|
||||
AppZip: fmt.Sprintf("seanime-desktop-%s_Windows_x86_64.exe", version),
|
||||
Sig: fmt.Sprintf("seanime-desktop-%s_Windows_x86_64.sig", version),
|
||||
},
|
||||
}
|
||||
|
||||
// Function to generate URL based on asset names
|
||||
generateURL := func(filename string) string {
|
||||
return fmt.Sprintf("%s%s", DownloadUrl, filename)
|
||||
}
|
||||
|
||||
// Prepare the JSON structure
|
||||
latestJSON := map[string]interface{}{
|
||||
"version": version,
|
||||
"pub_date": time.Now().Format(time.RFC3339), // Change to the actual publish date
|
||||
"platforms": map[string]map[string]string{
|
||||
"linux-x86_64": {
|
||||
"url": generateURL(assets["Linux_x86_64"].Asset),
|
||||
"signature": getContent(assets["Linux_x86_64"].Sig),
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"url": generateURL(assets["Windows_x86_64"].AppZip),
|
||||
"signature": getContent(assets["Windows_x86_64"].Sig),
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"url": generateURL(assets["MacOS_x86_64"].Asset),
|
||||
"signature": getContent(assets["MacOS_x86_64"].Sig),
|
||||
},
|
||||
"darwin-aarch64": {
|
||||
"url": generateURL(assets["MacOS_arm64"].Asset),
|
||||
"signature": getContent(assets["MacOS_arm64"].Sig),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Remove non-existent assets
|
||||
for platform, asset := range latestJSON["platforms"].(map[string]map[string]string) {
|
||||
if asset["signature"] == "" {
|
||||
delete(latestJSON["platforms"].(map[string]map[string]string), platform)
|
||||
}
|
||||
}
|
||||
|
||||
// Write to latest.json
|
||||
outputPath := filepath.Join(".", "latest.json")
|
||||
file, err := os.Create(outputPath)
|
||||
if err != nil {
|
||||
fmt.Println("Error creating file:", err)
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
encoder := json.NewEncoder(file)
|
||||
encoder.SetIndent("", " ")
|
||||
if err := encoder.Encode(latestJSON); err != nil {
|
||||
fmt.Println("Error writing JSON to file:", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("Generated %s successfully.\n", outputPath)
|
||||
}
|
||||
|
||||
func getContent(filename string) string {
|
||||
fileContent, err := os.ReadFile(filepath.Join(".", filename))
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(fileContent)
|
||||
}
|
||||
Reference in New Issue
Block a user