🚧
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/**
|
38
vss.v
38
vss.v
|
@ -4,13 +4,15 @@ import os
|
||||||
import cli
|
import cli
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
const markdown_text = "
|
const markdown_text = '
|
||||||
# Open Sea
|
# Open Sea
|
||||||
|
|
||||||
A static site generator
|
A static site generator
|
||||||
|
|
||||||
- [GitHub](https://github.com/zztkm)
|
- [GitHub](https://github.com/zztkm)
|
||||||
"
|
'
|
||||||
|
|
||||||
|
const default_dist = 'dist'
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut app := cli.Command{
|
mut app := cli.Command{
|
||||||
|
@ -18,6 +20,20 @@ fn main() {
|
||||||
version: '0.0.0'
|
version: '0.0.0'
|
||||||
description: 'static site generator'
|
description: 'static site generator'
|
||||||
execute: fn (cmd cli.Command) ? {
|
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')
|
paths := get_paths('testfiles')
|
||||||
if paths.len == 0 {
|
if paths.len == 0 {
|
||||||
println('Cloud not retrieve path')
|
println('Cloud not retrieve path')
|
||||||
|
@ -32,16 +48,12 @@ fn main() {
|
||||||
contents := markdown.to_html(markdown_text)
|
contents := markdown.to_html(markdown_text)
|
||||||
|
|
||||||
index_html := $tmpl('layouts/_index.html')
|
index_html := $tmpl('layouts/_index.html')
|
||||||
os.write_file('index.html', 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
|
return
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app.setup()
|
|
||||||
app.parse(os.args)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_paths(path string) []string {
|
|
||||||
mds := os.walk_ext(path, '.md')
|
|
||||||
return mds
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue