mirror of
https://github.com/mcuadros/ascode
synced 2024-11-22 17:02:03 +01:00
documentation: hugo configuration and gh-pages action
This commit is contained in:
parent
1771710198
commit
7fcbabf206
8
.github/workflows/docker.yml
vendored
8
.github/workflows/docker.yml
vendored
@ -1,5 +1,11 @@
|
||||
name: Docker Push
|
||||
on: [push, create]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
29
.github/workflows/gh-pages.yml
vendored
Normal file
29
.github/workflows/gh-pages.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Documentation
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
jobs:
|
||||
gh-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
with:
|
||||
hugo-version: '0.68.2'
|
||||
extended: true
|
||||
|
||||
- name: Hugo Build
|
||||
run: make hugo-build
|
||||
|
||||
- name: Push to gh-pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./_site/public
|
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@ -1,5 +1,11 @@
|
||||
name: Test
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.providers
|
||||
_site
|
32
Makefile
32
Makefile
@ -1,6 +1,8 @@
|
||||
BASE_PATH := $(realpath -s $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
|
||||
|
||||
# Documentation
|
||||
OUTLINE_CMD ?= outline
|
||||
DOCUMENTATION_PATH ?= _documentation
|
||||
DOCUMENTATION_PATH ?= $(BASE_PATH)/_documentation
|
||||
DOCUMENTATION_REFERENCE_PATH ?= $(DOCUMENTATION_PATH)/reference
|
||||
DOCUMENTATION_REFERENCE_TEMPLATE ?= $(DOCUMENTATION_REFERENCE_PATH)/reference.md.tmpl
|
||||
EXAMPLES_PATH ?= starlark/types/testdata/examples
|
||||
@ -23,9 +25,16 @@ GO_LDFLAGS_PACKAGES = \
|
||||
starlarkVersion=go.starlark.net \
|
||||
terraformVersion=github.com/hashicorp/terraform
|
||||
|
||||
# Site
|
||||
HUGO_SITE_PATH ?= $(BASE_PATH)/_site
|
||||
HUGO_SITE_CONTENT_PATH ?= $(HUGO_SITE_PATH)/content
|
||||
HUGO_SITE_TEMPLATE_PATH ?= $(HUGO_SITE_PATH)/themes/hugo-ascode-theme
|
||||
HUGO_THEME_URL ?= https://github.com/mcuadros/hugo-ascode-theme
|
||||
HUGO_PARAMS_VERSION ?= dev
|
||||
export HUGO_PARAMS_VERSION
|
||||
|
||||
# Rules
|
||||
.PHONY: documentation
|
||||
.PHONY: documentation clean hugo-server
|
||||
|
||||
documentation: $(RUNTIME_MODULES)
|
||||
$(RUNTIME_MODULES): $(DOCUMENTATION_RUNTIME_PATH)
|
||||
@ -40,3 +49,22 @@ $(DOCUMENTATION_REFERENCE_PATH):
|
||||
|
||||
goldflags:
|
||||
@$(GO_LDFLAGS_CMD) $(GO_LDFLAGS_PACKAGE) . $(GO_LDFLAGS_PACKAGES)
|
||||
|
||||
hugo-build: $(HUGO_SITE_PATH)
|
||||
hugo --minify --source $(HUGO_SITE_PATH) --config $(DOCUMENTATION_PATH)/config.toml
|
||||
|
||||
hugo-server: $(HUGO_SITE_PATH)
|
||||
hugo server --source $(HUGO_SITE_PATH) --config $(DOCUMENTATION_PATH)/config.toml
|
||||
|
||||
$(HUGO_SITE_PATH): $(HUGO_SITE_TEMPLATE_PATH)
|
||||
mkdir -p $@ \
|
||||
mkdir -p $(HUGO_SITE_CONTENT_PATH)
|
||||
mkdir -p $(HUGO_SITE_TEMPLATE_PATH)
|
||||
ln -s $(DOCUMENTATION_PATH) $(HUGO_SITE_CONTENT_PATH)/docs
|
||||
ln -s $(DOCUMENTATION_PATH)/_home.md $(HUGO_SITE_CONTENT_PATH)/_index.md
|
||||
|
||||
$(HUGO_SITE_TEMPLATE_PATH):
|
||||
git clone $(HUGO_THEME_URL) $(HUGO_SITE_TEMPLATE_PATH)
|
||||
|
||||
clean:
|
||||
rm -rf $(HUGO_SITE_PATH)
|
4
_documentation/_home.md
Normal file
4
_documentation/_home.md
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
---
|
||||
|
||||
AsCode allows you to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL.
|
47
_documentation/config.toml
Normal file
47
_documentation/config.toml
Normal file
@ -0,0 +1,47 @@
|
||||
baseURL = "ascode.run"
|
||||
languageCode = "en-us"
|
||||
title = "AsCode - Terraform Alternative Syntax"
|
||||
theme = "hugo-ascode-theme"
|
||||
|
||||
pygmentsCodeFences = true
|
||||
pygmentsCodefencesGuessSyntax = true
|
||||
pygmentsUseClasses = true
|
||||
|
||||
[[menu.main]]
|
||||
name = "Home"
|
||||
url = "/"
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
name = "Docs"
|
||||
url = "/docs/"
|
||||
weight = 2
|
||||
|
||||
[[menu.main]]
|
||||
name = "GitHub"
|
||||
url = "https://github.com/mcuadros/ascode"
|
||||
weight = 3
|
||||
|
||||
[markup.goldmark.renderer]
|
||||
unsafe = true
|
||||
autoHeadingIDType = "github"
|
||||
|
||||
[params]
|
||||
version=""
|
||||
google_analytics_id=""
|
||||
homepage_button_link = '/docs'
|
||||
homepage_button_text = 'Read The Docs'
|
||||
homepage_intro = 'AsCode allows you to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL.'
|
||||
homepage_image = '/images/terminal.gif'
|
||||
|
||||
[params.homepage_meta_tags]
|
||||
meta_description = "AsCode allows you to describe your infrastructure using an expressive language in Terraform without writing a single line of HCL."
|
||||
meta_og_title = "AsCode - Terraform Alternative Syntax"
|
||||
meta_og_type = "website"
|
||||
meta_og_url = "https://ascode.run"
|
||||
meta_og_image = "https://ascode.run/images/og.png"
|
||||
meta_og_description = "AsCode - Terraform Alternative Syntax."
|
||||
|
||||
[params.logo]
|
||||
mobile = "/images/logo-mobile.svg"
|
||||
standard = "/images/logo.svg"
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'Getting Started'
|
||||
weight: 2
|
||||
----
|
||||
---
|
||||
|
||||
TODO
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'GitHub Action'
|
||||
weight: 40
|
||||
----
|
||||
---
|
||||
|
||||
TODO
|
@ -1,140 +0,0 @@
|
||||
{{- define "functionName" }}
|
||||
{{- if ne .Receiver "types" -}}
|
||||
#
|
||||
{{- end -}}
|
||||
### def {{ if ne .Receiver "types" -}}
|
||||
<i>{{ .Receiver }}</i>.
|
||||
{{- end -}}
|
||||
<b>{{- (index (split .Signature "(") 0) -}}</b>
|
||||
{{- end -}}
|
||||
{{- define "function" }}
|
||||
|
||||
{{ template "functionName" . }}
|
||||
```go
|
||||
{{if ne .Receiver "types" -}}{{.Receiver}}.{{- end }}{{ .Signature }}
|
||||
```
|
||||
|
||||
{{- if ne .Description "" }}
|
||||
{{ .Description }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if gt (len .Params) 0 }}
|
||||
|
||||
###### Arguments
|
||||
|
||||
| name | type | description |
|
||||
|------|------|-------------|
|
||||
{{ range .Params -}}
|
||||
| `{{ .Name }}` | `{{ .Type }}` | {{ (replace_all .Description "\n" "") }} |
|
||||
{{ end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- if gt (len .Examples) 0 }}
|
||||
###### Examples
|
||||
{{ range .Examples -}}
|
||||
{{ .Description }}
|
||||
```python
|
||||
{{ .Code }}
|
||||
```
|
||||
{{ end -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
||||
{{- define "indexFunctionName" -}}
|
||||
{{- $receiver := "" -}}
|
||||
{{ if ne .Receiver "types" -}}{{ $receiver = printf "<i>%s</i>." .Receiver }}{{- end -}}
|
||||
{{- $name := printf "def <b>%s</b>" (index (split .Signature "(") 0) -}}
|
||||
{{- $anchor := printf "def %s<b>%s</b>" $receiver (index (split .Signature "(") 0) -}}
|
||||
* [{{ $name }}({{ (index (split .Signature "(") 1) }}](#{{ sanitizeAnchor $anchor }})
|
||||
{{- end -}}
|
||||
|
||||
{{- define "index" -}}
|
||||
## Index
|
||||
<div class="toc">
|
||||
{{ range .Functions }}
|
||||
{{ template "indexFunctionName" . }}
|
||||
{{- end -}}
|
||||
{{ range .Types -}}
|
||||
{{ $name := printf "type <b>%s</b>" .Name }}
|
||||
* [{{ $name }}](#{{ sanitizeAnchor $name }})
|
||||
{{- range .Methods }}
|
||||
{{ template "indexFunctionName" . -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{ end -}}
|
||||
|
||||
|
||||
{{- range . -}}
|
||||
---
|
||||
title: '{{ .Path }}'
|
||||
---
|
||||
|
||||
{{ if ne .Description "" }}{{ .Description }}{{ end }}
|
||||
|
||||
{{ template "index" . }}
|
||||
|
||||
|
||||
{{- if gt (len .Functions) 0 }}
|
||||
## Functions
|
||||
{{ range .Functions -}}
|
||||
{{ template "function" . }}
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
|
||||
{{ if gt (len .Types) 0 }}
|
||||
## Types
|
||||
{{ range .Types -}}
|
||||
|
||||
|
||||
### type <b>{{ .Name }}</b>
|
||||
{{ if ne .Description "" }}{{ .Description }}{{ end -}}
|
||||
{{ if gt (len .Fields) 0 }}
|
||||
|
||||
###### Properties
|
||||
|
||||
| name | type | description |
|
||||
|------|------|-------------|
|
||||
{{ range .Fields -}}
|
||||
| `{{ .Name }}` | `{{ .Type }}` | {{ (replace_all .Description "\n" "") }} |
|
||||
{{ end -}}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ if gt (len .Examples) 0 }}
|
||||
###### Examples
|
||||
{{ range .Examples -}}
|
||||
{{ .Description }}
|
||||
```python
|
||||
{{ .Code }}
|
||||
```
|
||||
{{ end -}}
|
||||
|
||||
|
||||
{{ end -}}
|
||||
|
||||
{{ if gt (len .Methods) 0 }}
|
||||
|
||||
###### Methods
|
||||
|
||||
{{- range .Methods -}}
|
||||
{{ template "function" . }}
|
||||
{{ end -}}
|
||||
{{- if gt (len .Operators) 0 }}
|
||||
|
||||
###### Operators
|
||||
|
||||
| operator | description |
|
||||
|----------|-------------|
|
||||
{{ range .Operators -}}
|
||||
| {{ .Opr }} | {{ .Description }} |
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
Loading…
Reference in New Issue
Block a user