🚧
This commit is contained in:
parent
3eb1b876bd
commit
c2bd1636e7
2 changed files with 113 additions and 18 deletions
83
.github/workflows/release.yaml
vendored
Normal file
83
.github/workflows/release.yaml
vendored
Normal file
|
@ -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/**
|
48
vss.v
48
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,22 +20,7 @@ fn main() {
|
|||
version: '0.0.0'
|
||||
description: 'static site generator'
|
||||
execute: fn (cmd cli.Command) ? {
|
||||
paths := get_paths('testfiles')
|
||||
if paths.len == 0 {
|
||||
println('Cloud not retrieve path')
|
||||
return
|
||||
}
|
||||
for path in paths {
|
||||
println(path)
|
||||
}
|
||||
|
||||
// index_html := $embed_file("layouts/_index.html")
|
||||
title := 'tsurutatakumi.info'
|
||||
contents := markdown.to_html(markdown_text)
|
||||
|
||||
index_html := $tmpl('layouts/_index.html')
|
||||
os.write_file('index.html', index_html) ?
|
||||
return
|
||||
generate_index_page()?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,3 +32,28 @@ 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')
|
||||
return
|
||||
}
|
||||
for path in paths {
|
||||
println(path)
|
||||
}
|
||||
|
||||
// index_html := $embed_file("layouts/_index.html")
|
||||
title := 'tsurutatakumi.info'
|
||||
contents := markdown.to_html(markdown_text)
|
||||
|
||||
index_html := $tmpl('layouts/_index.html')
|
||||
dist := default_dist
|
||||
|
||||
if !os.exists(dist) {
|
||||
os.mkdir_all(dist, ) // build/_dist/ のようなPATHが渡されても作成できるようにmkdir_allを使う
|
||||
}
|
||||
path := os.join_path(dist, 'index.html')
|
||||
os.write_file(path, index_html)?
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue