mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +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:
|
||||
push:
|
||||
branches:
|
||||
@ -10,6 +10,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
buf_push:
|
||||
name: Publish to buf.build/onsonr/sonr
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Run `git checkout`
|
||||
@ -25,6 +26,7 @@ jobs:
|
||||
|
||||
upload_pkl:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish to pkl.sh
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
@ -40,6 +42,7 @@ jobs:
|
||||
|
||||
upload_nebula_cdn:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish to cdn.sonr.id
|
||||
steps:
|
||||
- name: checkout
|
||||
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:
|
||||
push:
|
||||
@ -12,6 +12,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
name: Release motr, sonrd, and DWN
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
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:
|
||||
push:
|
||||
@ -11,8 +11,8 @@ permissions:
|
||||
|
||||
jobs:
|
||||
run-tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Run tests"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- 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/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/uiux.pkl
|
||||
|
||||
start-caddy:
|
||||
@echo "(start-caddy) Starting caddy"
|
||||
|
@ -1,11 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/gommon/log"
|
||||
@ -30,26 +26,11 @@ func NewProxyCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
e.GET("/", pages.Home)
|
||||
e.GET("/config", nebula.GetConfig)
|
||||
e.GET("/allocate", pages.Profile)
|
||||
|
||||
// Start server
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
|
||||
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)
|
||||
if err := e.Start(":1323"); err != http.ErrServerClosed {
|
||||
log.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
|
||||
var embeddedFiles embed.FS
|
||||
|
||||
//go:embed assets/config.pkl
|
||||
var config []byte
|
||||
|
||||
func getHTTPFS() (http.FileSystem, error) {
|
||||
fsys, err := fs.Sub(embeddedFiles, "assets")
|
||||
if err != nil {
|
||||
@ -30,3 +33,8 @@ func UseAssets(e *echo.Echo) error {
|
||||
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
|
||||
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