no message

This commit is contained in:
2025-02-11 09:37:03 +03:00
parent 299f6dea06
commit 30cb80efcd
26 changed files with 530 additions and 317 deletions

View File

@@ -9,10 +9,18 @@ pub mut:
reset bool // regenerate all, dangerous !!!
interactive bool // if we want to ask
path string
playonly bool
model ?GenModel
cat ?Cat
}
pub struct PlayArgs {
pub mut:
name string
modulepath string
}
// the default to start with
//
// reset bool // regenerate all, dangerous !!!
@@ -20,7 +28,9 @@ pub mut:
// path string
// model ?GenModel
// cat ?Cat
pub fn do(args_ GenerateArgs) ! {
//
// will return the module path where we need to execute a play command as well as the name of
pub fn do(args_ GenerateArgs) ! PlayArgs{
mut args := args_
console.print_header('Generate code for path: ${args.path} (reset:${args.reset}, interactive:${args.interactive})')
@@ -51,9 +61,9 @@ pub fn do(args_ GenerateArgs) ! {
}
}
if model.cat == .unknown {
model.cat = args.cat or { return error('cat needs to be specified for generator.') }
}
// if model.cat == .unknown {
// model.cat = args.cat or { return error('cat needs to be specified for generator.') }
// }
if args.interactive {
ask(args.path)!
@@ -64,5 +74,15 @@ pub fn do(args_ GenerateArgs) ! {
console.print_debug(args)
//only generate if playonly is false and there is a classname
if !args.playonly && model.classname.len>0{
generate(args)!
}
return PlayArgs{
name: model.play_name
modulepath: model.module_path
}
}

View File

@@ -20,6 +20,8 @@ pub mut:
build bool = true
hasconfig bool = true
cat Cat // dont' set default
play_name string // e.g. docusaurus is what we look for
module_path string // e.g.freeflowuniverse.herolib.web.docusaurus
}
pub enum Cat {
@@ -37,7 +39,6 @@ pub fn gen_model_set(args GenerateArgs) ! {
.installer { $tmpl('templates/heroscript_installer') }
else { return error('Invalid category: ${model.cat}') }
}
pathlib.template_write(heroscript_templ, '${args.path}/.heroscript', true)!
}
@@ -108,8 +109,30 @@ pub fn gen_model_get(path string, create bool) !GenModel {
model.name = os.base(path).to_lower()
}
console.print_debug('Code generator get: ${model}')
model.play_name = model.name
pathsub:=path.replace('${os.home_dir()}/code/github/','')
model.module_path = pathsub.replace("/",".").replace(".lib.",".")
// !!hero_code.play
// name:'docusaurus'
mut play_actions := plbook.find(filter: 'hero_code.play')!
if play_actions.len>1{
return error("should have max 1 hero_code.play action in ${config_path.path}")
}
if play_actions.len==1{
mut p := play_actions[0].params
model.play_name = p.get_default('name',model.name)!
}
if model.module_path.contains("docusaurus"){
println(model)
println("4567ujhjk")
exit(0)
}
return model
// return GenModel{}
}

View File

@@ -1,6 +1,8 @@
# generation framework for clients & installers
```bash
#generate all play commands
hero generate -playonly
#will ask questions if .heroscript is not there yet
hero generate -p thepath_is_optional
# to generate without questions

View File

@@ -10,6 +10,7 @@ pub mut:
reset bool // regenerate all, dangerous !!!
interactive bool // if we want to ask
path string
playonly bool
}
// scan over a set of directories call the play where
@@ -19,6 +20,7 @@ pub fn scan(args ScannerArgs) ! {
if args.path == '' {
scan(path: '${os.home_dir()}/code/github/freeflowuniverse/herolib/lib/installers')!
scan(path: '${os.home_dir()}/code/github/freeflowuniverse/herolib/lib/clients')!
scan(path: '${os.home_dir()}/code/github/freeflowuniverse/herolib/lib/web')!
return
}
@@ -36,7 +38,7 @@ pub fn scan(args ScannerArgs) ! {
pparent := p.parent()!
path_module := pparent.path
if os.exists('${path_module}/.heroscript') {
do(interactive: args.interactive, path: path_module, reset: args.reset)!
do(interactive: args.interactive, path: path_module, reset: args.reset, playonly:args.playonly)!
}
}
}

View File

@@ -20,6 +20,9 @@ pub mut:
path string
force bool
hasconfig bool = true
playonly bool
play_name string // e.g. docusaurus is what we look for
module_path string // e.g.freeflowuniverse.herolib.web.docusaurus
}
pub enum Cat {
@@ -80,5 +83,5 @@ fn args_get(path string) !GeneratorArgs {
}
}
return error("can't find hero_code.generate_client or hero_code.generate_installer in ${path}")
// return GeneratorArgs{}
}

View File

@@ -36,6 +36,13 @@ pub fn cmd_generator(mut cmdroot Command) {
description: 'will work non interactive if possible.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
name: 'playonly'
description: 'generate the play script.'
})
cmd_run.add_flag(Flag{
flag: .bool
required: false
@@ -59,9 +66,14 @@ fn cmd_generator_execute(cmd Command) ! {
mut force := cmd.flags.get_bool('force') or { false }
mut reset := cmd.flags.get_bool('reset') or { false }
mut scan := cmd.flags.get_bool('scan') or { false }
mut playonly := cmd.flags.get_bool('playonly') or { false }
mut installer := cmd.flags.get_bool('installer') or { false }
mut path := cmd.flags.get_string('path') or { '' }
if playonly{
force=true
}
if path == '' {
path = os.getwd()
}
@@ -74,7 +86,7 @@ fn cmd_generator_execute(cmd Command) ! {
}
if scan {
generic.scan(path: path, reset: reset, force: force, cat: cat)!
generic.scan(path: path, reset: reset, force: force, cat: cat, playonly:playonly)!
} else {
generic.generate(path: path, reset: reset, force: force, cat: cat)!
}

View File

@@ -11,3 +11,4 @@
startupmanager:1
hasconfig:1
build:1

View File

@@ -0,0 +1,3 @@
!!hero_code.play
name:'docusaurus'

View File

@@ -3,6 +3,118 @@ module docusaurus
import json
import os
//THE FOLLOWING STRUCTS CAN BE SERIALIZED IN
// main.json
// Main
// {
// "title": "Internet Geek",
// "tagline": "Internet Geek",
// "favicon": "img/favicon.png",
// "url": "https://friends.threefold.info",
// "url_home": "docs/",
// "baseUrl": "/kristof/",
// "image": "img/tf_graph.png",
// "metadata": {
// "description": "ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.",
// "image": "https://threefold.info/kristof/img/tf_graph.png",
// "title": "ThreeFold Technology Vision"
// },
// "buildDest":"root@info.ourworld.tf:/root/hero/www/info",
// "buildDestDev":"root@info.ourworld.tf:/root/hero/www/infodev"
// }
//
// navbar.json
// Navbar:
// {
// "title": "Kristof = Chief Executive Geek",
// "items": [
// {
// "href": "https://threefold.info/kristof/",
// "label": "ThreeFold Technology",
// "position": "right"
// },
// {
// "href": "https://threefold.io",
// "label": "ThreeFold.io",
// "position": "right"
// }
// ]
// }
//
// footer.json
// Footer:
// {
// "style": "dark",
// "links": [
// {
// "title": "Docs",
// "items": [
// {
// "label": "Introduction",
// "to": "/docs"
// },
// {
// "label": "TFGrid V4 Docs",
// "href": "https://docs.threefold.io/"
// }
// ]
// },
// {
// "title": "Community",
// "items": [
// {
// "label": "Telegram",
// "href": "https://t.me/threefold"
// },
// {
// "label": "X",
// "href": "https://x.com/threefold_io"
// }
// ]
// },
// {
// "title": "Links",
// "items": [
// {
// "label": "ThreeFold.io",
// "href": "https://threefold.io"
// }
// ]
// }
// ]
// }
// Combined config structure
pub struct Config {
pub mut:
footer Footer
main Main
navbar Navbar
build_destinations []BuildDest
import_sources []ImportSource
ssh_connections []SSHConnection
}
// THE SUBELEMENTS
pub struct Main {
pub mut:
name string
title string
tagline string
favicon string
url string
url_home string
base_url string @[json: 'baseUrl']
image string
metadata MainMetadata
build_dest []string
build_dest_dev []string
}
// Footer config structures
pub struct FooterItem {
pub mut:
@@ -31,20 +143,6 @@ pub mut:
title string
}
pub struct Main {
pub mut:
name string
title string
tagline string
favicon string
url string
url_home string
base_url string @[json: 'baseUrl']
image string
metadata MainMetadata
build_dest []string @[json: 'buildDest']
build_dest_dev []string @[json: 'buildDestDev']
}
// Navbar config structures
pub struct NavbarItem {
@@ -60,65 +158,44 @@ pub mut:
items []NavbarItem
}
// Combined config structure
pub struct Config {
pub struct SSHConnection {
pub mut:
footer Footer
main Main
navbar Navbar
name string = 'main'
login string = 'root' //e.g. 'root'
host string // e.g. info.ourworld.tf
port int = 21 //default is std ssh port
key string
key_path string //location of the key (private ssh key to be able to connect over ssh)
}
// load_config loads all configuration from the specified directory
pub fn load_config(cfg_dir string) !Config {
// Ensure the config directory exists
if !os.exists(cfg_dir) {
return error('Config directory ${cfg_dir} does not exist')
pub struct BuildDest {
pub mut:
ssh_name string = 'main'
path string //can be on the ssh root or direct path e.g. /root/hero/www/info
}
// Load and parse footer config
footer_content := os.read_file(os.join_path(cfg_dir, 'footer.json'))!
footer := json.decode(Footer, footer_content)!
// Load and parse main config
main_config_path := os.join_path(cfg_dir, 'main.json')
main_content := os.read_file(main_config_path)!
main := json.decode(Main, main_content) or {
eprintln("${main_config_path} is not in the right format please fix.")
println('
## EXAMPLE OF A GOOD ONE:
- note the list for buildDest and buildDestDev
- note its the full path where the html is pushed too
{
"title": "ThreeFold Web4",
"tagline": "ThreeFold Web4",
"favicon": "img/favicon.png",
"url": "https://docs.threefold.io",
"url_home": "docs/introduction",
"baseUrl": "/",
"image": "img/tf_graph.png",
"metadata": {
"description": "ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.",
"image": "https://threefold.info/kristof/img/tf_graph.png",
"title": "ThreeFold Docs"
},
"buildDest":["root@info.ourworld.tf:/root/hero/www/info/tfgrid4"],
"buildDestDev":["root@info.ourworld.tf:/root/hero/www/infodev/tfgrid4"]
}
')
exit(99)
pub struct ImportSource {
pub mut:
url string //http git url can be to specific path
path string
dest string //location in the docs folder of the place where we will build docusaurus
replace map[string]string //will replace ${NAME} in the imported content
}
// Load and parse navbar config
navbar_content := os.read_file(os.join_path(cfg_dir, 'navbar.json'))!
navbar := json.decode(Navbar, navbar_content)!
return Config{
footer: footer
main: main
navbar: navbar
}
// Export config as JSON files (main.json, navbar.json, footer.json)
pub fn (config Config) export_json(path string) ! {
// Ensure directory exists
os.mkdir_all(path)!
// Export main.json
os.write_file("${path}/main.json", json.encode_pretty(config.main))!
// Export navbar.json
os.write_file("${path}/navbar.json", json.encode_pretty(config.navbar))!
// Export footer.json
os.write_file("${path}/footer.json", json.encode_pretty(config.footer))!
}

View File

@@ -0,0 +1,60 @@
module docusaurus
import json
import os
// load_config loads all configuration from the specified directory
pub fn load_config(cfg_dir string) !Config {
// Ensure the config directory exists
if !os.exists(cfg_dir) {
return error('Config directory ${cfg_dir} does not exist')
}
// Load and parse footer config
footer_content := os.read_file(os.join_path(cfg_dir, 'footer.json'))!
footer := json.decode(Footer, footer_content)!
// Load and parse main config
main_config_path := os.join_path(cfg_dir, 'main.json')
main_content := os.read_file(main_config_path)!
main := json.decode(Main, main_content) or {
eprintln("${main_config_path} is not in the right format please fix.")
println('
## EXAMPLE OF A GOOD ONE:
- note the list for buildDest and buildDestDev
- note its the full path where the html is pushed too
{
"title": "ThreeFold Web4",
"tagline": "ThreeFold Web4",
"favicon": "img/favicon.png",
"url": "https://docs.threefold.io",
"url_home": "docs/introduction",
"baseUrl": "/",
"image": "img/tf_graph.png",
"metadata": {
"description": "ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.",
"image": "https://threefold.info/kristof/img/tf_graph.png",
"title": "ThreeFold Docs"
},
"buildDest":["root@info.ourworld.tf:/root/hero/www/info/tfgrid4"],
"buildDestDev":["root@info.ourworld.tf:/root/hero/www/infodev/tfgrid4"]
}
')
exit(99)
}
// Load and parse navbar config
navbar_content := os.read_file(os.join_path(cfg_dir, 'navbar.json'))!
navbar := json.decode(Navbar, navbar_content)!
return Config{
footer: footer
main: main
navbar: navbar
}
}

162
lib/web/docusaurus/play.v Normal file
View File

@@ -0,0 +1,162 @@
module docusaurus
import freeflowuniverse.herolib.core.playbook { PlayBook }
@[params]
pub struct PlayArgs {
pub mut:
heroscript string //if filled in then playbook will be made out of it
plbook ?playbook.PlayBook
reset bool
}
// Process the heroscript and return a filled Config object
pub fn play(args_ PlayArgs) ! {
mut plbook := playbook.new(text: args_.heroscript)!
mut config := Config{}
play_config(mut plbook, mut config)!
play_config_meta(mut plbook, mut config)!
play_ssh_connection(mut plbook, mut config)!
play_import_source(mut plbook, mut config)!
play_build_dest(mut plbook, mut config)!
play_navbar(mut plbook, mut config)!
play_footer(mut plbook, mut config)!
}
fn play_config(mut plbook playbook.PlayBook, mut config Config) ! {
config_actions := plbook.find(filter: 'docusaurus.config')!
for action in config_actions {
mut p := action.params
config.main = Main{
title: p.get_default('title', 'Internet Geek')!
tagline: p.get_default('tagline', 'Internet Geek')!
favicon: p.get_default('favicon', 'img/favicon.png')!
url: p.get_default('url', 'https://friends.threefold.info')!
url_home: p.get_default('url_home', 'docs/')!
base_url: p.get_default('base_url', '/testsite/')!
image: p.get_default('image', 'img/tf_graph.png')!
}
}
}
fn play_config_meta(mut plbook playbook.PlayBook, mut config Config) ! {
meta_actions := plbook.find(filter: 'docusaurus.config_meta')!
for action in meta_actions {
mut p := action.params
config.main.metadata = MainMetadata{
description: p.get_default('description', 'ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.')!
image: p.get_default('image', 'https://threefold.info/something/img/tf_graph.png')!
title: p.get_default('title', 'ThreeFold Technology Vision')!
}
}
}
fn play_ssh_connection(mut plbook playbook.PlayBook, mut config Config) ! {
ssh_actions := plbook.find(filter: 'docusaurus.ssh_connection')!
for action in ssh_actions {
mut p := action.params
mut ssh := SSHConnection{
name: p.get_default('name', 'main')!
host: p.get_default('host', 'info.ourworld.tf')!
port: p.get_int_default('port', 21)!
login: p.get_default('login', 'root')!
key_path: p.get_default('key_path', '')!
key: p.get_default('key', '')!
}
config.ssh_connections << ssh
}
}
fn play_import_source(mut plbook playbook.PlayBook, mut config Config) ! {
import_actions := plbook.find(filter: 'docusaurus.import_source')!
for action in import_actions {
mut p := action.params
mut replace_map := map[string]string{}
if replace_str := p.get_default('replace', '') {
parts := replace_str.split(',')
for part in parts {
kv := part.split(':')
if kv.len == 2 {
replace_map[kv[0].trim_space()] = kv[1].trim_space()
}
}
}
mut import_ := ImportSource{
url: p.get('url')!
path: p.get_default('path', '')!
dest: p.get_default('dest', '')!
replace: replace_map
}
config.import_sources << import_
}
}
fn play_build_dest(mut plbook playbook.PlayBook, mut config Config) ! {
build_actions := plbook.find(filter: 'docusaurus.build_dest')!
for action in build_actions {
mut p := action.params
mut build := BuildDest{
ssh_name: p.get_default('ssh_name', 'main')!
path:p.get_default('path', '')!
}
config.build_destinations << build
}
}
fn play_navbar(mut plbook playbook.PlayBook, mut config Config) ! {
navbar_actions := plbook.find(filter: 'docusaurus.navbar')!
for action in navbar_actions {
mut p := action.params
config.navbar.title = p.get_default('title', 'Chief Executive Geek')!
}
navbar_item_actions := plbook.find(filter: 'docusaurus.navbar_item')!
for action in navbar_item_actions {
mut p := action.params
mut item := NavbarItem{
label: p.get_default('label', 'ThreeFold Technology')!
href: p.get_default('href', 'https://threefold.info/tech')!
position: p.get_default('position', 'right')!
}
config.navbar.items << item
}
}
fn play_footer(mut plbook playbook.PlayBook, mut config Config) ! {
footer_actions := plbook.find(filter: 'docusaurus.footer')!
for action in footer_actions {
mut p := action.params
config.footer.style = p.get_default('style', 'dark')!
}
footer_item_actions := plbook.find(filter: 'docusaurus.footer_item')!
mut links_map := map[string][]FooterItem{}
for action in footer_item_actions {
mut p := action.params
title := p.get_default('title', 'Docs')!
mut item := FooterItem{
label: p.get_default('label', 'Introduction')!
to: p.get_default('to', '/docs')!
href: p.get_default('href', '')!
}
if title !in links_map {
links_map[title] = []FooterItem{}
}
links_map[title] << item
}
// Convert map to footer links array
for title, items in links_map {
config.footer.links << FooterLink{
title: title
items: items
}
}
}

View File

@@ -0,0 +1,84 @@
## Definition of the main config
!!docusaurus.config
title: 'Internet Geek'
tagline: 'Internet Geek'
favicon: 'img/favicon.png'
url: 'https://friends.threefold.info'
url_home: 'docs/'
base_url: '/testsite/'
image: 'img/tf_graph.png'
!!docusaurus.config_meta
description: 'ThreeFold is laying the foundation for a geo aware Web 4, the next generation of the Internet.'
image: 'https://threefold.info/kristof/img/tf_graph.png'
title: 'ThreeFold Technology Vision'
## Definition of the imports & build destinations
!!docusaurus.ssh_connection name:'main' host:'info.ourworld.tf' port:'21' login:'root' passwd:'' key_path:'' key:''
!!docusaurus.import_source
url:'https://git.ourworld.tf/ourworld_holding/info_docs_owh/src/branch/main/docs'
path:''
dest:'' //if empty is root of docs
replace:'NAME:MyName, URGENCY:red'
!!docusaurus.build_dest ssh_name:'main'
path:' /root/hero/www/info/testsite'
## Definition of the navbar (is the top of the page)
!!docusaurus.navbar title:'Kristof = Chief Executive Geek'
!!docusaurus.navbar_item
label: "ThreeFold Technology"
href: "https://threefold.info/tech"
position: "right" #left or right
!!docusaurus.navbar_item
label: "ThreeFold Website"
href: "https://threefold.io"
position: "right" #left or right
## Definition of the footer
!!docusaurus.footer style:dark
#FIRST PART OF FOOTER (IS VERTICAL PART)
!!docusaurus.footer_item
title: 'Docs'
label: 'Introduction'
to: '/docs'
!!docusaurus.footer_item
title: 'Docs'
label: 'TFGrid V4 Docs'
href: 'https://docs.threefold.io/'
#2ND PART OF FOOTER (IS VERTICAL PART)
!!docusaurus.footer_item
title: 'Community'
label: 'Telegram'
href: 'https://t.me/threefold'
!!docusaurus.footer_item
title: 'Community'
label: 'X'
href: 'https://x.com/threefold_io'
#3E PART OF FOOTER (IS VERTICAL PART)
!!docusaurus.footer_item
title: 'Links'
label: 'ThreeFold.io'
href: 'https://threefold.io'

View File

@@ -1,97 +0,0 @@
name: Build Hero on Linux & Run tests
permissions:
contents: write
on:
push:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
short-name: linux-i64
# - target: aarch64-unknown-linux-musl
# os: ubuntu-latest
# short-name: linux-arm64
# - target: aarch64-apple-darwin
# os: macos-latest
# short-name: macos-arm64
# - target: x86_64-apple-darwin
# os: macos-13
# short-name: macos-i64
runs-on: ${{ matrix.os }}
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref_name }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Vlang
run: |
git clone --depth=1 https://github.com/vlang/v
cd v
make
sudo ./v symlink
cd ..
- name: Setup Herolib
run: |
mkdir -p ~/.vmodules/freeflowuniverse
ln -s $GITHUB_WORKSPACE/lib ~/.vmodules/freeflowuniverse/herolib
echo "Installing secp256k1..."
# Install build dependencies
sudo apt-get install -y build-essential wget autoconf libtool
# Download and extract secp256k1
cd /tmp
wget https://github.com/bitcoin-core/secp256k1/archive/refs/tags/v0.3.2.tar.gz
tar -xvf v0.3.2.tar.gz
# Build and install
cd secp256k1-0.3.2/
./autogen.sh
./configure
make -j 5
sudo make install
# Cleanup
rm -rf secp256k1-0.3.2 v0.3.2.tar.gz
echo "secp256k1 installation complete!"
- name: Install and Start Redis
run: |
# Import Redis GPG key
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
# Add Redis repository
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
# Install Redis
sudo apt-get update
sudo apt-get install -y redis
# Start Redis
redis-server --daemonize yes
# Print versions
redis-cli --version
redis-server --version
- name: Build Hero
run: |
v -cg -enable-globals -w -n cli/hero.v
- name: Do all the basic tests
run: |
./test_basic.vsh
env:
LIVEKIT_API_KEY: ${{secrets.LIVEKIT_API_KEY}}
LIVEKIT_API_SECRET: ${{secrets.LIVEKIT_API_SECRET}}
LIVEKIT_URL: ${{secrets.LIVEKIT_URL}}

View File

@@ -1,41 +0,0 @@
name: Build Hero & Run tests
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
short-name: linux-i64
- target: aarch64-apple-darwin
os: macos-latest
short-name: macos-arm64
- target: x86_64-apple-darwin
os: macos-13
short-name: macos-i64
runs-on: ${{ matrix.os }}
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref_name }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Vlang
run: ./install_v.sh --github-actions
- name: Setup Herolib
run: ./install_herolib.vsh
- name: Build Hero
run: |
v -w -cg -gc none -d use_openssl -enable-globals cli/hero.v
- name: Do all the basic tests
run: |
./test_basic.vsh

View File

@@ -1,98 +0,0 @@
name: Release
on:
push:
tags:
- v*
jobs:
upload:
strategy:
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
short-name: macos-arm64
- target: x86_64-apple-darwin
os: macos-13
short-name: macos-i64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
short-name: linux-i64
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Vlang
run: ./install_v.sh --github-actions
- name: Setup Herolib
run: ./install_herolib.vsh
- name: Build Hero
run: |
v -w -cg -gc none -d use_openssl -enable-globals cli/hero.v -o cli/hero-${{ matrix.target }}
- name: Upload
uses: actions/upload-artifact@v4
with:
name: hero-${{ matrix.target }}
path: cli/hero-${{ matrix.target }}
release_hero:
needs: upload
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
# TODO: this adds commits that don't belong to this branhc, check another action
# - name: Generate changelog
# id: changelog
# uses: heinrichreimer/github-changelog-generator-action@v2.3
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# headerLabel: "# 📑 Changelog"
# breakingLabel: "### 💥 Breaking"
# enhancementLabel: "### 🚀 Enhancements"
# bugsLabel: "### 🐛 Bug fixes"
# securityLabel: "### 🛡️ Security"
# issuesLabel: "### 📁 Other issues"
# prLabel: "### 📁 Other pull requests"
# addSections: '{"documentation":{"prefix":"### 📖 Documentation","labels":["documentation"]},"tests":{"prefix":"### ✅ Testing","labels":["tests"]}}'
# onlyLastTag: true
# issues: false
# issuesWoLabels: false
# pullRequests: true
# prWoLabels: true
# author: true
# unreleased: true
# compareLink: true
# stripGeneratorNotice: true
# verbose: true
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: cli/bins
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
draft: false
fail_on_unmatched_files: true
# body: ${{ steps.changelog.outputs.changelog }}
files: cli/bins/*