Skip to content

Commit 09e00bf

Browse files
vbattsMa Shimiao
authored andcommitted
version: include version in produced docs (opencontainers#406)
Fixes opencontainers#398 Signed-off-by: Vincent Batts <[email protected]>
1 parent c6cdd70 commit 09e00bf

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output
22
schema/validate
33
code-of-conduct.md
4+
version.md

.tool/version-doc.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// +build ignore
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
"html/template"
8+
"os"
9+
10+
"github.com/opencontainers/runtime-spec/specs-go"
11+
)
12+
13+
var markdownTemplateString = `
14+
15+
**Specification Version:** *{{.}}*
16+
17+
`
18+
19+
var markdownTemplate = template.Must(template.New("markdown").Parse(markdownTemplateString))
20+
21+
func main() {
22+
if err := markdownTemplate.Execute(os.Stdout, specs.Version); err != nil {
23+
fmt.Fprintln(os.Stderr, err)
24+
}
25+
}

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
DOCKER ?= $(shell which docker)
33
# These docs are in an order that determines how they show up in the PDF/HTML docs.
44
DOC_FILES := \
5+
version.md \
56
README.md \
67
code-of-conduct.md \
78
principles.md \
@@ -45,6 +46,9 @@ output/docs.html: $(DOC_FILES)
4546
code-of-conduct.md:
4647
curl -o $@ https://raw.githubusercontent.com/opencontainers/tob/d2f9d68c1332870e40693fe077d311e0742bc73d/code-of-conduct.md
4748

49+
version.md: ./specs-go/version.go
50+
go run ./.tool/version-doc.go > $@
51+
4852
HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
4953
# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
5054
ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' == '$(1)' && echo 'true')

0 commit comments

Comments
 (0)