Skip to content

Commit

Permalink
v2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed May 16, 2023
1 parent 4964619 commit 62d97f8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 26 deletions.
2 changes: 1 addition & 1 deletion v2/cmd/wails/internal/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.5.0
v2.5.1
89 changes: 64 additions & 25 deletions v2/tools/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package main

import (
"encoding/json"
"github.com/samber/lo"
"os"
"os/exec"
"strconv"
"strings"
"time"

"github.com/wailsapp/wails/v2/internal/s"
)
Expand Down Expand Up @@ -43,45 +45,82 @@ func runCommand(name string, arg ...string) {
checkError(err)
}

func IsPointRelease(currentVersion string, newVersion string) bool {
// The first n-1 parts of the version should be the same
if currentVersion[:len(currentVersion)-2] != newVersion[:len(newVersion)-2] {
return false
}
// split on the last dot in the string
currentVersionSplit := strings.Split(currentVersion, ".")
newVersionSplit := strings.Split(newVersion, ".")
// compare the
// if the last part of the version is the same, it's a point release
currentMinor := lo.Must(strconv.Atoi(currentVersionSplit[len(currentVersionSplit)-1]))
newMinor := lo.Must(strconv.Atoi(newVersionSplit[len(newVersionSplit)-1]))
return newMinor == currentMinor+1
}

func main() {
var newVersion string
var isPointRelease bool
if len(os.Args) > 1 {
newVersion = os.Args[1]
err := os.WriteFile(versionFile, []byte(newVersion), 0755)
currentVersion, err := os.ReadFile(versionFile)
checkError(err)
err = os.WriteFile(versionFile, []byte(newVersion), 0755)
checkError(err)
isPointRelease = IsPointRelease(string(currentVersion), newVersion)
} else {
newVersion = updateVersion()
}

// Update ChangeLog
s.CD("../../../website")
runCommand("npx", "-y", "pnpm", "install")

s.ECHO("Generating new Docs for version: " + newVersion)
// Read in `src/pages/changelog.mdx`
changelogData, err := os.ReadFile("src/pages/changelog.mdx")
checkError(err)
changelog := string(changelogData)
// Split on the line that has `## [Unreleased]`
changelogSplit := strings.Split(changelog, "## [Unreleased]")
// Get today's date in YYYY-MM-DD format
today := time.Now().Format("2006-01-02")
// Add the new version to the top of the changelog
newChangelog := changelogSplit[0] + "## [Unreleased]\n\n## [" + newVersion + "] - " + today + changelogSplit[1]
// Write the changelog back
err = os.WriteFile("src/pages/changelog.mdx", []byte(newChangelog), 0755)
checkError(err)

runCommand("npx", "pnpm", "run", "docusaurus", "docs:version", newVersion)
if !isPointRelease {
runCommand("npx", "-y", "pnpm", "install")

runCommand("npx", "pnpm", "run", "write-translations")
s.ECHO("Generating new Docs for version: " + newVersion)

// Load the version list/*
versionsData, err := os.ReadFile("versions.json")
checkError(err)
var versions []string
err = json.Unmarshal(versionsData, &versions)
checkError(err)
oldestVersion := versions[len(versions)-1]
s.ECHO(oldestVersion)
versions = versions[0 : len(versions)-1]
newVersions, err := json.Marshal(&versions)
checkError(err)
err = os.WriteFile("versions.json", newVersions, 0755)
checkError(err)
runCommand("npx", "pnpm", "run", "docusaurus", "docs:version", newVersion)

runCommand("npx", "pnpm", "run", "write-translations")

// Load the version list/*
versionsData, err := os.ReadFile("versions.json")
checkError(err)
var versions []string
err = json.Unmarshal(versionsData, &versions)
checkError(err)
oldestVersion := versions[len(versions)-1]
s.ECHO(oldestVersion)
versions = versions[0 : len(versions)-1]
newVersions, err := json.Marshal(&versions)
checkError(err)
err = os.WriteFile("versions.json", newVersions, 0755)
checkError(err)

s.ECHO("Removing old version: " + oldestVersion)
s.CD("versioned_docs")
s.RMDIR("version-" + oldestVersion)
s.CD("../versioned_sidebars")
s.RM("version-" + oldestVersion + "-sidebars.json")
s.CD("..")
s.ECHO("Removing old version: " + oldestVersion)
s.CD("versioned_docs")
s.RMDIR("version-" + oldestVersion)
s.CD("../versioned_sidebars")
s.RM("version-" + oldestVersion + "-sidebars.json")
s.CD("..")

runCommand("npx", "pnpm", "run", "build")
runCommand("npx", "pnpm", "run", "build")
}
}
2 changes: 2 additions & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v2.5.1] - 2023-05-16

### Breaking Changes

- The Go WebView2Loader allowed env variable and registry overrides to change the behaviour of WebView2. This is not possible when using the native WebView2Loader with Wails and should not be possible according to [PR](https://github.com/wailsapp/wails/pull/1771). Changed by @stffabi in [PR](https://github.com/wailsapp/wails/pull/2668)
Expand Down

0 comments on commit 62d97f8

Please sign in to comment.