mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 08:26:04 +08:00
Updated callout on bresenham_line.md
Added support for showing the ETL version on the documentation first page, by copying the version.txt file as a hugo asset. Updated the Python 'update_release.py' to copy 'version.txt'
This commit is contained in:
parent
3f81df564e
commit
d5f4ac5177
39
.github/workflows/deploy_documentation.yml
vendored
Normal file
39
.github/workflows/deploy_documentation.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Deploy documentation to www.etlcpp.com
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_deploy:
|
||||
name: build and deploy
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: '0.147.1'
|
||||
extended: true
|
||||
|
||||
- name: Build
|
||||
working-directory: hugo
|
||||
run: hugo --minify --cleanDestinationDir --baseURL "https://www.etlcpp.com/"
|
||||
|
||||
# Deploys the site via the deploy script in the ci directory
|
||||
- name: Deploy
|
||||
run: source $GITHUB_WORKSPACE/scripts/deploy_documentation.sh
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.DOCS_BDEPLOY_KEY }}
|
||||
SSH_USERNAME: ${{ secrets.DOCS_SSH_USER }}
|
||||
SERVER_ADDRESS: ${{ secrets.DOCS_SSH_SERVER }}
|
||||
SERVER_DESTINATION: ${{ secrets.DOCS_DEST_DIR }}
|
||||
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
|
||||
@ -49,6 +49,9 @@ type: hextra-home
|
||||
|
||||
</div>
|
||||
|
||||
## Version
|
||||
This documents version **{{< version >}}**.
|
||||
|
||||
## Motivation
|
||||
|
||||
C++ is a powerful language for embedded systems development, with templates offering a great deal of flexibility and type safety. While the C++ Standard Library provides a wealth of well-tested functionality, it’s often not well suited to environments with strict deterministic behavior and limited resources.
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
title: "bresenham_line"
|
||||
---
|
||||
|
||||
{{< callout type="info">}}
|
||||
Headers: `bresenham_line.h`
|
||||
{{< /callout >}}
|
||||
|
||||
A 'pseudo' container that generates coordinates on a line between two points using the [Bresenham line algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
|
||||
The class has an STL-like API and is a forward iterator type container.
|
||||
|
||||
|
||||
1
hugo/assets/version.txt
Normal file
1
hugo/assets/version.txt
Normal file
@ -0,0 +1 @@
|
||||
20.47.1
|
||||
3
hugo/layouts/shortcodes/version.html
Normal file
3
hugo/layouts/shortcodes/version.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{ with resources.Get "version.txt" }}
|
||||
{{ .Content | strings.TrimSpace }}
|
||||
{{ end }}
|
||||
16
scripts/deploy_documentation.sh
Executable file
16
scripts/deploy_documentation.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Set up SSH
|
||||
mkdir -p ~/.ssh
|
||||
echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
|
||||
# Add server to known hosts
|
||||
ssh-keyscan -p "$SSH_PORT" "$SERVER_ADDRESS" >> ~/.ssh/known_hosts
|
||||
|
||||
# Deploy using rsync over SSH
|
||||
rsync -avz --delete \
|
||||
-e "ssh -i ~/.ssh/deploy_key -p $SSH_PORT" \
|
||||
hugo/public/ \
|
||||
"$SSH_USERNAME@$SERVER_ADDRESS:$SERVER_DESTINATION"
|
||||
@ -1,10 +1,10 @@
|
||||
|
||||
|
||||
import shutil
|
||||
import os
|
||||
|
||||
# Get the current path of the script
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
# Get the root folder of the ETL
|
||||
etl_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
|
||||
|
||||
@ -14,6 +14,9 @@ include_dir = os.path.join(etl_dir, 'include')
|
||||
# Get the ETL headers folder
|
||||
headers_dir = os.path.join(include_dir, 'etl')
|
||||
|
||||
# Get the Hugo folder
|
||||
hugo_dir = os.path.join(etl_dir, 'hugo')
|
||||
|
||||
# Get the Arduino folder
|
||||
arduino_dir = os.path.join(etl_dir, 'arduino')
|
||||
|
||||
@ -54,6 +57,7 @@ def create_arduino_variant():
|
||||
print('etl_dir = ', etl_dir)
|
||||
print('include_dir = ', include_dir)
|
||||
print('headers_dir = ', headers_dir)
|
||||
print('hugo_dir = ', hugo_dir)
|
||||
print('arduino_dir = ', arduino_dir)
|
||||
print('examples_dir = ', arduino_examples_dir)
|
||||
print('common_dir = ', common_dir)
|
||||
@ -121,7 +125,7 @@ def get_version():
|
||||
version_file = os.path.join(etl_dir, 'version.txt')
|
||||
print('')
|
||||
print('version_file = ', version_file)
|
||||
|
||||
|
||||
with open(version_file) as f:
|
||||
version = f.read().splitlines()
|
||||
|
||||
@ -135,10 +139,10 @@ def update_version_h():
|
||||
print('Creating version.h')
|
||||
|
||||
version_h = os.path.join(headers_dir, 'version.h')
|
||||
|
||||
|
||||
with open(version_h) as f:
|
||||
text = f.read().splitlines()
|
||||
|
||||
|
||||
search_major = '#define ETL_VERSION_MAJOR '
|
||||
search_minor = '#define ETL_VERSION_MINOR '
|
||||
search_patch = '#define ETL_VERSION_PATCH '
|
||||
@ -148,19 +152,19 @@ def update_version_h():
|
||||
length_patch = len(search_patch)
|
||||
|
||||
for i in range(len(text) - 1):
|
||||
|
||||
|
||||
index = text[i].find(search_major)
|
||||
if index != -1:
|
||||
text[i] = text[i][index:length_major] + major_version
|
||||
print(text[i])
|
||||
|
||||
|
||||
index = text[i].find(search_minor)
|
||||
if index != -1:
|
||||
text[i] = text[i][index:length_minor] + minor_version
|
||||
print(text[i])
|
||||
|
||||
index = text[i].find(search_patch)
|
||||
if index != -1:
|
||||
if index != -1:
|
||||
text[i] = text[i][index:length_patch] + patch_version
|
||||
print(text[i])
|
||||
|
||||
@ -169,17 +173,31 @@ def update_version_h():
|
||||
f.write(line)
|
||||
f.write('\n')
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
def update_hugo_version_txt():
|
||||
print('')
|
||||
print('Copying version.txt to hugo/assets')
|
||||
|
||||
src = os.path.join(etl_dir, 'version.txt')
|
||||
dst = os.path.join(hugo_dir, 'assets', 'version.txt')
|
||||
|
||||
try:
|
||||
shutil.copyfile(src, dst)
|
||||
print("Copy successful!")
|
||||
except PermissionError:
|
||||
print(f"Permission denied. Check if the file is open or locked.")
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
def update_library_json(filename):
|
||||
print('')
|
||||
print('Creating %s' % filename)
|
||||
|
||||
|
||||
with open(filename) as f:
|
||||
text = f.read().splitlines()
|
||||
|
||||
|
||||
search = 'version'
|
||||
|
||||
for i in range(len(text) - 1):
|
||||
for i in range(len(text) - 1):
|
||||
index = text[i].find(search)
|
||||
if index != -1:
|
||||
text[i] = ' \"version\": \"' + full_version + '\",'
|
||||
@ -196,10 +214,10 @@ def update_library_properties(filename):
|
||||
|
||||
with open(filename, 'r') as f:
|
||||
text = f.read().splitlines()
|
||||
|
||||
|
||||
search = 'version'
|
||||
|
||||
for i in range(len(text) - 1):
|
||||
for i in range(len(text) - 1):
|
||||
index = text[i].find(search)
|
||||
if index != -1:
|
||||
text[i] = 'version=' + full_version
|
||||
@ -224,7 +242,8 @@ def update_versions():
|
||||
print("Version = %s.%s.%s" % (major_version, minor_version, patch_version ))
|
||||
|
||||
update_version_h()
|
||||
|
||||
update_hugo_version_txt()
|
||||
|
||||
update_library_json(os.path.join(etl_dir, 'library.json'))
|
||||
update_library_json(os.path.join(arduino_dir, 'library-arduino.json'))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user