mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
refactor: rename buf-publish.yml to publish-assets.yml
This commit is contained in:
parent
6f3fa0ec38
commit
9478227547
@ -1,4 +1,4 @@
|
|||||||
name: Publish to buf.build/didao/sonr
|
name: Upload Public Assets
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -10,6 +10,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
buf_push:
|
buf_push:
|
||||||
|
name: Publish to buf.build/onsonr/sonr
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Run `git checkout`
|
# Run `git checkout`
|
||||||
@ -25,6 +26,7 @@ jobs:
|
|||||||
|
|
||||||
upload_pkl:
|
upload_pkl:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish to pkl.sh
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -40,6 +42,7 @@ jobs:
|
|||||||
|
|
||||||
upload_nebula_cdn:
|
upload_nebula_cdn:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish to cdn.sonr.id
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
3
.github/workflows/scheduled-release.yml
vendored
3
.github/workflows/scheduled-release.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: "Release Binary"
|
name: Scheduled Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -12,6 +12,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
|
name: Release motr, sonrd, and DWN
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
4
.github/workflows/version-bump.yml
vendored
4
.github/workflows/version-bump.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Bump version
|
name: Update Version
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -11,8 +11,8 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run-tests:
|
run-tests:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: "Run tests"
|
name: "Run tests"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
|
1
Makefile
1
Makefile
@ -320,6 +320,7 @@ pkl:
|
|||||||
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/fmt.pkl
|
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/fmt.pkl
|
||||||
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/orm.pkl
|
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/orm.pkl
|
||||||
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl
|
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl
|
||||||
|
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/uiux.pkl
|
||||||
|
|
||||||
start-caddy:
|
start-caddy:
|
||||||
@echo "(start-caddy) Starting caddy"
|
@echo "(start-caddy) Starting caddy"
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/labstack/gommon/log"
|
"github.com/labstack/gommon/log"
|
||||||
@ -30,26 +26,11 @@ func NewProxyCmd() *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e.GET("/", pages.Home)
|
e.GET("/", pages.Home)
|
||||||
|
e.GET("/config", nebula.GetConfig)
|
||||||
e.GET("/allocate", pages.Profile)
|
e.GET("/allocate", pages.Profile)
|
||||||
|
|
||||||
// Start server
|
if err := e.Start(":1323"); err != http.ErrServerClosed {
|
||||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
|
log.Fatal(err)
|
||||||
defer stop()
|
|
||||||
// Start server
|
|
||||||
go func() {
|
|
||||||
if err := e.Start(":1323"); err != nil && err != http.ErrServerClosed {
|
|
||||||
e.Logger.Fatal("shutting down the server")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds.
|
|
||||||
<-ctx.Done()
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
// Shutdown the server with 10 seconds timeout.
|
|
||||||
if err := e.Shutdown(ctx); err != nil {
|
|
||||||
e.Logger.Fatal(err)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
2
pkg/nebula/assets/config.pkl
Normal file
2
pkg/nebula/assets/config.pkl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import "https://pkl.sh/uiux.pkl";
|
||||||
|
|
8
pkg/nebula/models/Button.pkl.go
Normal file
8
pkg/nebula/models/Button.pkl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Button struct {
|
||||||
|
Text string `pkl:"text"`
|
||||||
|
|
||||||
|
Href string `pkl:"href"`
|
||||||
|
}
|
20
pkg/nebula/models/Hero.pkl.go
Normal file
20
pkg/nebula/models/Hero.pkl.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Hero struct {
|
||||||
|
TitleFirst string `pkl:"titleFirst"`
|
||||||
|
|
||||||
|
TitleEmphasis string `pkl:"titleEmphasis"`
|
||||||
|
|
||||||
|
TitleSecond string `pkl:"titleSecond"`
|
||||||
|
|
||||||
|
Subtitle string `pkl:"subtitle"`
|
||||||
|
|
||||||
|
PrimaryButton *Button `pkl:"primaryButton"`
|
||||||
|
|
||||||
|
SecondaryButton *Button `pkl:"secondaryButton"`
|
||||||
|
|
||||||
|
Image *Image `pkl:"image"`
|
||||||
|
|
||||||
|
Stats []*Stat `pkl:"stats"`
|
||||||
|
}
|
10
pkg/nebula/models/Image.pkl.go
Normal file
10
pkg/nebula/models/Image.pkl.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Image struct {
|
||||||
|
Src string `pkl:"src"`
|
||||||
|
|
||||||
|
Width int `pkl:"width"`
|
||||||
|
|
||||||
|
Height int `pkl:"height"`
|
||||||
|
}
|
8
pkg/nebula/models/Link.pkl.go
Normal file
8
pkg/nebula/models/Link.pkl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Link struct {
|
||||||
|
Text string `pkl:"text"`
|
||||||
|
|
||||||
|
Href string `pkl:"href"`
|
||||||
|
}
|
52
pkg/nebula/models/Models.pkl.go
Normal file
52
pkg/nebula/models/Models.pkl.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/apple/pkl-go/pkl"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Models struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
|
||||||
|
func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) {
|
||||||
|
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
cerr := evaluator.Close()
|
||||||
|
if err == nil {
|
||||||
|
err = cerr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadFromURL loads the pkl module at the given URL and evaluates it into a Models
|
||||||
|
func LoadFromURL(ctx context.Context, url string) (ret *Models, err error) {
|
||||||
|
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
cerr := evaluator.Close()
|
||||||
|
if err == nil {
|
||||||
|
err = cerr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ret, err = Load(ctx, evaluator, pkl.UriSource(url))
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models
|
||||||
|
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
|
||||||
|
var ret Models
|
||||||
|
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ret, nil
|
||||||
|
}
|
8
pkg/nebula/models/SocialLink.pkl.go
Normal file
8
pkg/nebula/models/SocialLink.pkl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type SocialLink struct {
|
||||||
|
Link *Link `pkl:"link"`
|
||||||
|
|
||||||
|
Icon string `pkl:"icon"`
|
||||||
|
}
|
8
pkg/nebula/models/Stat.pkl.go
Normal file
8
pkg/nebula/models/Stat.pkl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
type Stat struct {
|
||||||
|
Value string `pkl:"value"`
|
||||||
|
|
||||||
|
Label string `pkl:"label"`
|
||||||
|
}
|
1
pkg/nebula/models/common.go
Normal file
1
pkg/nebula/models/common.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package models
|
14
pkg/nebula/models/init.pkl.go
Normal file
14
pkg/nebula/models/init.pkl.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||||
|
package models
|
||||||
|
|
||||||
|
import "github.com/apple/pkl-go/pkl"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
pkl.RegisterMapping("models", Models{})
|
||||||
|
pkl.RegisterMapping("models#Image", Image{})
|
||||||
|
pkl.RegisterMapping("models#Link", Link{})
|
||||||
|
pkl.RegisterMapping("models#SocialLink", SocialLink{})
|
||||||
|
pkl.RegisterMapping("models#Button", Button{})
|
||||||
|
pkl.RegisterMapping("models#Stat", Stat{})
|
||||||
|
pkl.RegisterMapping("models#Hero", Hero{})
|
||||||
|
}
|
1
pkg/nebula/models/marketing.go
Normal file
1
pkg/nebula/models/marketing.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package models
|
@ -11,6 +11,9 @@ import (
|
|||||||
//go:embed assets
|
//go:embed assets
|
||||||
var embeddedFiles embed.FS
|
var embeddedFiles embed.FS
|
||||||
|
|
||||||
|
//go:embed assets/config.pkl
|
||||||
|
var config []byte
|
||||||
|
|
||||||
func getHTTPFS() (http.FileSystem, error) {
|
func getHTTPFS() (http.FileSystem, error) {
|
||||||
fsys, err := fs.Sub(embeddedFiles, "assets")
|
fsys, err := fs.Sub(embeddedFiles, "assets")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -30,3 +33,8 @@ func UseAssets(e *echo.Echo) error {
|
|||||||
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
|
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetConfig is a middleware that serves the config file
|
||||||
|
func GetConfig(e echo.Context) error {
|
||||||
|
return e.Blob(http.StatusOK, "application/octet-stream", config)
|
||||||
|
}
|
||||||
|
44
pkl/uiux.pkl
Normal file
44
pkl/uiux.pkl
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
@go.Package { name = "github.com/onsonr/sonr/pkg/nebula/models" }
|
||||||
|
|
||||||
|
module models
|
||||||
|
|
||||||
|
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||||
|
|
||||||
|
class Image {
|
||||||
|
src: String
|
||||||
|
width: Int
|
||||||
|
height: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
class Link {
|
||||||
|
text: String
|
||||||
|
href: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class SocialLink {
|
||||||
|
link: Link
|
||||||
|
icon: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class Button {
|
||||||
|
text: String
|
||||||
|
href: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class Stat {
|
||||||
|
value: String
|
||||||
|
label: String
|
||||||
|
}
|
||||||
|
|
||||||
|
class Hero {
|
||||||
|
titleFirst: String
|
||||||
|
titleEmphasis: String
|
||||||
|
titleSecond: String
|
||||||
|
subtitle: String
|
||||||
|
primaryButton: Button
|
||||||
|
secondaryButton: Button
|
||||||
|
image: Image
|
||||||
|
stats: List<Stat>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user