From 102525ba3adb1752702ffb1aac581d9611c269ce Mon Sep 17 00:00:00 2001 From: Simon Kirsten <simon.kirsten@stud.h-da.de> Date: Sun, 3 Nov 2019 21:10:24 +0100 Subject: [PATCH] Using pymdown-env include $VERSION in docs --- .gitlab-ci-docs.yml | 9 +++++++-- .gitlab-ci-pages.yml | 2 +- .gitlab-ci-server.yml | 29 ++++++++++++++++------------- .gitlab-ci.yml | 2 -- docs/download-and-run.md | 20 +++++++++----------- mkdocs.yml | 1 + 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci-docs.yml b/.gitlab-ci-docs.yml index 9d69da1..f9b4cca 100644 --- a/.gitlab-ci-docs.yml +++ b/.gitlab-ci-docs.yml @@ -6,10 +6,15 @@ docs: before_script: # TODO: we should consider also version locking these packages: - # + everything will work in the future - # - we wont see any future improvements by mkdocs or mkdocs-material + # ++ everything will work in the future + # -- we won't see any future improvements of the mkdocs and mkdocs-material packages - pip install mkdocs - pip install mkdocs-material + + # This is my own extension that we use to insert the $VERSION env variable into the documentation + - pip install pymdown-env + # load version from prep stage + - export VERSION=$(cat version) script: - mkdocs build diff --git a/.gitlab-ci-pages.yml b/.gitlab-ci-pages.yml index 1c271bd..effa399 100644 --- a/.gitlab-ci-pages.yml +++ b/.gitlab-ci-pages.yml @@ -5,7 +5,7 @@ pages: script: - mv site public # rename mkdocs output to public - - mv binaries public/ # move server binaries to public/ + - mv bin public/ # move server binaries to public/ artifacts: paths: diff --git a/.gitlab-ci-server.yml b/.gitlab-ci-server.yml index 77a4ef9..bf475be 100644 --- a/.gitlab-ci-server.yml +++ b/.gitlab-ci-server.yml @@ -6,27 +6,30 @@ server: before_script: - go mod download - # TWITCH_CLIENT_ID is supplied via the GitLab CI/CD environment variables. This way only project owners can see the private key - - export LDFLAGS="-s -X stream-server/internal/server.defaultTwitchClientID=$TWITCH_CLIENT_ID -X stream-server/internal/server.Version=$(cat version)" # install packr2 binary - go get -u github.com/gobuffalo/packr/v2/packr2 - - pushd internal/server/; packr2; popd + # load version from prep stage + - export VERSION=$(cat version) + # TWITCH_CLIENT_ID is supplied via the GitLab CI/CD environment variables. This way only project owners can see the private key + - export LDFLAGS="-s -X stream-server/internal/server.defaultTwitchClientID=$TWITCH_CLIENT_ID -X stream-server/internal/server.Version=$VERSION" script: - - env GOOS=darwin GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/darwin-x86/stream-server ./cmd/stream-server - - env GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/darwin-x86_64/stream-server ./cmd/stream-server + - pushd internal/server/; packr2; popd + + - env GOOS=darwin GOARCH=386 go build -ldflags "$LDFLAGS" -o bin/$VERSION/darwin-x86/stream-server ./cmd/stream-server + - env GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o bin/$VERSION/darwin-x86_64/stream-server ./cmd/stream-server - - env GOOS=linux GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/linux-x86/stream-server ./cmd/stream-server - - env GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/linux-x86_64/stream-server ./cmd/stream-server - - env GOOS=linux GOARCH=arm go build -ldflags "$LDFLAGS" -o binaries/linux-arm/stream-server ./cmd/stream-server - - env GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o binaries/linux-arm64/stream-server ./cmd/stream-server + - env GOOS=linux GOARCH=386 go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-x86/stream-server ./cmd/stream-server + - env GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-x86_64/stream-server ./cmd/stream-server + - env GOOS=linux GOARCH=arm go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-arm/stream-server ./cmd/stream-server + - env GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o bin/$VERSION/linux-arm64/stream-server ./cmd/stream-server - - env GOOS=windows GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/windows-x86/stream-server.exe ./cmd/stream-server - - env GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/windows-x86_64/stream-server.exe ./cmd/stream-server + - env GOOS=windows GOARCH=386 go build -ldflags "$LDFLAGS" -o bin/$VERSION/windows-x86/stream-server.exe ./cmd/stream-server + - env GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o bin/$VERSION/windows-x86_64/stream-server.exe ./cmd/stream-server artifacts: - paths: # pass binaries directory to deploy stage - - binaries/ + paths: # pass bin directory to deploy stage + - bin/ # We don't really need to keep old builds. We can always just rebuild them expire_in: 1d diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a89594d..69bf852 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,5 +22,3 @@ version: # We don't really need to keep old builds. We can always just rebuild them expire_in: 1d - - diff --git a/docs/download-and-run.md b/docs/download-and-run.md index e78b646..e6c14cc 100644 --- a/docs/download-and-run.md +++ b/docs/download-and-run.md @@ -2,20 +2,18 @@ ## Download -Version ` ---8<-- "version" -` +Version `~~~${VERSION}~~~` OS | CPU Platform | Download --------------- | ------------- | ---------------------------------------------------------------------- -Windows | 64 bit | [stream-server.exe](../binaries/windows-x86_64/stream-server.exe) - | 32 bit | [stream-server.exe](../binaries/windows-x86/stream-server.exe) -Linux | 64 bit | [stream-server](../binaries/linux-x86_64/stream-server) - | 32 bit | [stream-server](../binaries/linux-x86/stream-server) - | ARM64 | [stream-server](../binaries/linux-arm64/stream-server) - | ARM32 | [stream-server](../binaries/linux-arm/stream-server) -Darwin (macOS) | 64 bit | [stream-server](../binaries/darwin-x86_64/stream-server) - | 32 bit | [stream-server](../binaries/darwin-x86/stream-server) +Windows | 64 bit | [stream-server.exe](../bin/~~~${VERSION}~~~/windows-x86_64/stream-server.exe) + | 32 bit | [stream-server.exe](../bin/~~~${VERSION}~~~/windows-x86/stream-server.exe) +Linux | 64 bit | [stream-server](../bin/~~~${VERSION}~~~/linux-x86_64/stream-server) + | 32 bit | [stream-server](../bin/~~~${VERSION}~~~/linux-x86/stream-server) + | ARM64 | [stream-server](../bin/~~~${VERSION}~~~/linux-arm64/stream-server) + | ARM32 | [stream-server](../bin/~~~${VERSION}~~~/linux-arm/stream-server) +Darwin (macOS) | 64 bit | [stream-server](../bin/~~~${VERSION}~~~/darwin-x86_64/stream-server) + | 32 bit | [stream-server](../bin/~~~${VERSION}~~~/darwin-x86/stream-server) ??? expert info If you do not wish to use a precompiled executable you can [compile it yourself](../about/contributing/#server). diff --git a/mkdocs.yml b/mkdocs.yml index 570b6dd..c7c0c07 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -57,6 +57,7 @@ markdown_extensions: - pymdownx.tasklist: custom_checkbox: true - pymdownx.tilde + - pymdown_env # Page tree nav: -- GitLab