Merge pull request #28 from Visionatrix/fix/change-demo-video #59
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
name: Docs | |
on: | |
push: | |
branches: | |
- main | |
- 'version-*' | |
permissions: | |
contents: read | |
jobs: | |
build_push_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Docs dependencies | |
run: python3 -m pip install -r requirements.txt | |
- name: Download Swagger UI | |
run: | | |
wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.14.zip | |
unzip v5.17.14.zip -d swagger-ui | |
mv swagger-ui/swagger-ui-5.17.14/dist/ docs/swagger-ui | |
rm -rf v5.17.14.zip | |
- name: Build flows for each version | |
run: | | |
set -e | |
mkdir flows_publish | |
for branch in $(git branch -r | grep -E 'origin/version-'); do | |
local_branch=$(echo "$branch" | sed -E 's/origin\///') | |
if git show-ref --verify --quiet "refs/heads/$local_branch"; then | |
git checkout "$local_branch" | |
else | |
git checkout --track "$branch" | |
fi | |
version=$(echo "$branch" | sed -E 's/origin\/version-([0-9\.]+)/\1/') | |
zip -r "flows_publish/flows-$version.zip" flows | |
done | |
git checkout main | |
zip -r flows_publish/flows.zip flows | |
- name: Build and push Docs | |
run: | | |
export CHANGES_DATE=`date -d"@$(git log -1 --pretty=%ct)" --iso-8601=seconds` | |
make html | |
git config --global user.name bigcat88 | |
git config --global user.email "bigcat88@users.noreply.github.com" | |
docroot=`mktemp -d` | |
rsync -av "docs/_build/html/" "${docroot}/" | |
rsync -av "flows_publish/" "${docroot}/" | |
rsync -av "models_catalog.json" "${docroot}/" | |
rsync -av "docs/swagger-ui/" "${docroot}/swagger-ui/" | |
rsync -av "docs/swagger.html" "${docroot}/swagger.html" | |
pushd "${docroot}" | |
git init | |
git remote add deploy "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
git checkout -b gh-pages | |
touch .nojekyll | |
git add . | |
msg="Docs: commit ${GITHUB_SHA} made on ${CHANGES_DATE} from ${GITHUB_REF} by ${GITHUB_ACTOR}" | |
git commit -am "${msg}" | |
git push deploy gh-pages --force | |
popd | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_DOCS }} |