main
zztkm 2 years ago
parent 3eb1b876bd
commit c2bd1636e7

@ -0,0 +1,83 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
Release-on-Ubuntu:
name: Release on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.9.1
- name: make x86_64
run: make dist
- name: make aarch64
run: ./misc/build-aarch64.sh
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/**
Release-on-Darwin:
name: Release on Darwin
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.9.1
- name: make x86_64
run: make dist
- name: make aarch64
run: ./misc/build-aarch64.sh
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/**
Release-on-Windows:
name: Release on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
#- uses: goto-bus-stop/setup-zig@v1
# with:
# version: 0.9.1
- uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain
msystem: MINGW64
path-type: inherit
- name: make x86_64
shell: msys2 {0}
run: |
mingw32-make dist
#- name: make aarch64
# shell: msys2 {0}
# run: |
# mingw32-make ARCH=aarch64 CC="zig cc -target aarch64-windows"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/**

36
vss.v

@ -4,13 +4,15 @@ import os
import cli
import markdown
const markdown_text = "
const markdown_text = '
# Open Sea
A static site generator
- [GitHub](https://github.com/zztkm)
"
'
const default_dist = 'dist'
fn main() {
mut app := cli.Command{
@ -18,6 +20,20 @@ fn main() {
version: '0.0.0'
description: 'static site generator'
execute: fn (cmd cli.Command) ? {
generate_index_page()?
}
}
app.setup()
app.parse(os.args)
}
fn get_paths(path string) []string {
mds := os.walk_ext(path, '.md')
return mds
}
fn generate_index_page() ? {
paths := get_paths('testfiles')
if paths.len == 0 {
println('Cloud not retrieve path')
@ -32,16 +48,12 @@ fn main() {
contents := markdown.to_html(markdown_text)
index_html := $tmpl('layouts/_index.html')
os.write_file('index.html', index_html) ?
return
}
}
dist := default_dist
app.setup()
app.parse(os.args)
if !os.exists(dist) {
os.mkdir_all(dist, ) // build/_dist/ のようなPATHが渡されても作成できるようにmkdir_allを使う
}
fn get_paths(path string) []string {
mds := os.walk_ext(path, '.md')
return mds
path := os.join_path(dist, 'index.html')
os.write_file(path, index_html)?
return
}

Loading…
Cancel
Save