File tree Expand file tree Collapse file tree 3 files changed +72
-0
lines changed
Expand file tree Collapse file tree 3 files changed +72
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Upgrade Handler Check
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*.*.*'
7+ - ' v*.*.*-*'
8+
9+ jobs :
10+ check-upgrade-handler :
11+ name : Validate Upgrade Handler exists
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+
18+ - name : Setup Go
19+ uses : actions/setup-go@v5
20+ with :
21+ go-version-file : go.mod
22+
23+ - name : Run Upgrade Handler Checker
24+ run : |
25+ go run ./contrib/scripts/upgrade-handler-check.go "${{ github.ref_name }}"
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242
4343- [ #2271 ] ( https://github.com/NibiruChain/nibiru/pull/2271 ) - fix(ci): update tag-pattern for changelog step in releases
4444- [ #2270 ] ( https://github.com/NibiruChain/nibiru/pull/2270 ) - refactor(app): remove private keeper struct and transient/mem keys from app
45+ - [ #2288 ] ( https://github.com/NibiruChain/nibiru/pull/2288 ) - chore(ci): add workflow to check for missing upgrade handler
4546- [ #2278 ] ( https://github.com/NibiruChain/nibiru/pull/2278 ) - chore: migrate to cosmossdk.io/mathLegacyDec and cosmossdk.io/math.Int
4647
4748## v2.3.0
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "os"
6+ "regexp"
7+ "strings"
8+
9+ "github.com/NibiruChain/nibiru/v2/app"
10+ )
11+
12+ func main () {
13+ if len (os .Args ) < 2 {
14+ fmt .Println ("Usage: go run upgrade-handler-check.go <semver>" )
15+ os .Exit (1 )
16+ }
17+
18+ input := os .Args [1 ]
19+ coreVersion := extractCoreVersion (input )
20+
21+ found := false
22+ for _ , upgrade := range app .Upgrades {
23+ if upgrade .UpgradeName == coreVersion {
24+ found = true
25+ break
26+ }
27+ }
28+
29+ if found {
30+ fmt .Printf ("Upgrade handler for version %s exists ✅\n " , coreVersion )
31+ } else {
32+ fmt .Printf ("Upgrade handler for version %s does not exist ❌\n " , coreVersion )
33+ os .Exit (1 )
34+ }
35+ }
36+
37+ // extractCoreVersion strips any pre-release or build metadata from a semver string
38+ func extractCoreVersion (version string ) string {
39+ // Trim possible build/pre-release suffix using a simple regex
40+ re := regexp .MustCompile (`^v\d+\.\d+\.\d+` )
41+ match := re .FindString (version )
42+ if match != "" {
43+ return match
44+ }
45+ return strings .SplitN (version , "-" , 2 )[0 ] // Fallback just in case
46+ }
You can’t perform that action at this time.
0 commit comments