-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(common): deploy docs if component version got changed
- Loading branch information
1 parent
31187b7
commit f817197
Showing
6 changed files
with
254 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,66 @@ | ||
#!/bin/bash | ||
|
||
rm -rf docs | ||
|
||
if [ "$#" -eq 1 ]; then | ||
NEW_RELEASE=$1 | ||
fi | ||
|
||
build-docs --target esp32 --language en | ||
|
||
cp -rf _build/en/esp32/html . | ||
mkdir -p docs/generic | ||
mv _build/en/esp32/html docs/generic | ||
|
||
rm -rf _build __pycache__ | ||
|
||
if [ -n NEW_RELEASE ]; then | ||
URL="https://docs.espressif.com/projects/esp-protocols/asio/docs/latest/index.html" | ||
RELEASES=$(curl $URL | awk '/var RELEASES = \[/,/];/' | sed 's/var RELEASES = \[//' | sed 's/];$//' | tr -d '",') | ||
RELEASES+=(\'$NEW_RELEASE\') | ||
fi | ||
|
||
NEW_RELEASES=() | ||
for element in "${RELEASES[@]}"; do | ||
NEW_RELEASES+=("$element,") | ||
done | ||
echo ${NEW_RELEASES[@]} | ||
|
||
# Modifes some version and target fields of index.html | ||
echo "<script type="text/javascript"> | ||
window.onload =(function() { | ||
var myAnchor = document.getElementById('version-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'latest'; | ||
mySpan.setAttribute('disabled', true); | ||
var mySpan = document.createElement('select'); | ||
mySpan.style.float = 'left'; | ||
var latest_ver = document.createElement('option'); | ||
latest_ver.value = 'latest'; | ||
latest_ver.textContent = 'latest(master)'; | ||
mySpan.append(latest_ver); | ||
var RELEASES = [ | ||
$(echo ${NEW_RELEASES[@]}) | ||
]; | ||
for (var i = RELEASES.length - 1; i >= 0; i--) { | ||
var current_ver = document.createElement('option'); | ||
current_ver.value = RELEASES[i]; | ||
current_ver.textContent = 'release-'+ RELEASES[i]; | ||
mySpan.append(current_ver); | ||
} | ||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
mySpan.addEventListener('change', function() { | ||
window.location.href='https://docs.espressif.com/projects/esp-protocols/asio/docs/'+event.target.value+'/index.html' | ||
}); | ||
var myAnchor = document.getElementById('target-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.style.float = 'left'; | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'all targets'; | ||
mySpan.setAttribute('disabled', true); | ||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
})(); | ||
</script>" >> html/index.html | ||
</script>" | tee -a docs/generic/html/index.html > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,48 @@ | ||
rm -rf docs | ||
|
||
build-docs --target esp32 --language en | ||
|
||
cp -rf _build/en/esp32/html . | ||
mkdir -p docs/generic | ||
mv _build/en/esp32/html docs/generic | ||
|
||
rm -rf _build __pycache__ | ||
|
||
# Modifes some version and target fields of index.html | ||
echo "<script type="text/javascript"> | ||
window.onload =(function() { | ||
var myAnchor = document.getElementById('version-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'latest'; | ||
mySpan.setAttribute('disabled', true); | ||
var mySpan = document.createElement('select'); | ||
mySpan.style.float = 'left'; | ||
|
||
var latest_ver = document.createElement('option'); | ||
latest_ver.value = 'latest'; | ||
latest_ver.textContent = 'latest(master)'; | ||
mySpan.append(latest_ver); | ||
|
||
var RELEASES = [ | ||
'v0.1.0' | ||
]; | ||
for (var i = RELEASES.length - 1; i >= 0; i--) { | ||
var current_ver = document.createElement('option'); | ||
current_ver.value = RELEASES[i]; | ||
current_ver.textContent = 'release-'+ RELEASES[i]; | ||
mySpan.append(current_ver); | ||
} | ||
|
||
|
||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
mySpan.addEventListener('change', function() { | ||
window.location.href='https://docs.espressif.com/projects/esp-protocols/esp_mqtt_cxx/docs/'+event.target.value+'/index.html' | ||
}); | ||
|
||
var myAnchor = document.getElementById('target-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.style.float = 'left'; | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'all targets'; | ||
mySpan.setAttribute('disabled', true); | ||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
|
||
})(); | ||
</script>" >> html/index.html | ||
</script>" | tee -a docs/generic/html/index.html > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,48 @@ | ||
rm -rf docs | ||
|
||
build-docs --target esp32 --language en | ||
|
||
cp -rf _build/en/esp32/html . | ||
mkdir -p docs/generic | ||
mv _build/en/esp32/html docs/generic | ||
|
||
rm -rf _build __pycache__ | ||
|
||
# Modifes some version and target fields of index.html | ||
echo "<script type="text/javascript"> | ||
window.onload =(function() { | ||
var myAnchor = document.getElementById('version-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'latest'; | ||
mySpan.setAttribute('disabled', true); | ||
var mySpan = document.createElement('select'); | ||
mySpan.style.float = 'left'; | ||
|
||
var latest_ver = document.createElement('option'); | ||
latest_ver.value = 'latest'; | ||
latest_ver.textContent = 'latest(master)'; | ||
mySpan.append(latest_ver); | ||
|
||
var RELEASES = [ | ||
'v1.0.0' | ||
]; | ||
for (var i = RELEASES.length - 1; i >= 0; i--) { | ||
var current_ver = document.createElement('option'); | ||
current_ver.value = RELEASES[i]; | ||
current_ver.textContent = 'release-'+ RELEASES[i]; | ||
mySpan.append(current_ver); | ||
} | ||
|
||
|
||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
mySpan.addEventListener('change', function() { | ||
window.location.href='https://docs.espressif.com/projects/esp-protocols/esp_websocket_client/docs/'+event.target.value+'/index.html' | ||
}); | ||
|
||
var myAnchor = document.getElementById('target-select'); | ||
var mySpan = document.createElement('input'); | ||
mySpan.style.float = 'left'; | ||
mySpan.setAttribute('type', 'text'); | ||
mySpan.setAttribute('maxLength', '10'); | ||
mySpan.value = 'all targets'; | ||
mySpan.setAttribute('disabled', true); | ||
myAnchor.parentNode.replaceChild(mySpan, myAnchor); | ||
|
||
})(); | ||
</script>" >> html/index.html | ||
</script>" | tee -a docs/generic/html/index.html > /dev/null |
Oops, something went wrong.