Skip to content
12 changes: 6 additions & 6 deletions .github/workflows/on-docs-change.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Auto publish docs to version "develop"
name: on-docs-change

on:
push:
Expand Down Expand Up @@ -32,27 +32,27 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install mike==1.1.2 mkdocs-material==8.0.5 mkdocs-git-revision-date-plugin==0.3.1
pip install -r docs/requirements.txt
npm ci
- name: Setup doc deploy
run: |
git config --global user.name Docs deploy
git config --global user.email docs@dummy.bot.com
- name: Build mkdocs site in 'gh-pages' branch and push
- name: Build mkdocs site in "gh-pages" branch and push
run: |
rm -rf site
VERSION="develop"
VERSION="main"
ALIAS="stage"
mkdocs build
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
- name: Build API documentation site
run: |
rm -rf api
npm run docs-generateApiDoc
- name: Deploy API documentation site (copy to "gh-pages" branch inside the version folder)
- name: Release API docs to the main version
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api
keep_files: true
destination_dir: develop/api
destination_dir: main/api
52 changes: 49 additions & 3 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
with:
token: ${{ secrets.GH_PUBLISH_TOKEN }}
fetch-depth: 0

#########################
# Release new version
#########################
- name: "Use NodeJS 14"
uses: actions/setup-node@v2
with:
node-version: '14'

- name: "Setup npm"
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"

- name: Install packages
run: |
npm ci
Expand All @@ -46,3 +46,49 @@ jobs:
npx lerna version --conventional-commits --conventional-prerelease --preid beta --create-release github --force-publish=* --yes
fi
npx lerna publish from-git --no-verify-access --yes
#########################
# Generate documentation
#########################
- name: Set up Python
uses: actions/setup-python@v2.3.1
with:
python-version: '3.8'
- name: Set RELEASE_VERSION env var
run: |
RELEASE_VERSION=$(cat packages/commons/package.json | jq '.version' -r)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure it's going to work ... this version will be the one before ... the on-release workflow will bump the version and push a new commit with the new version in package.json as well as a corresponding git tag. And this commit skip ci to avoid infinite loop ... I think we should make this run only if the on-release succeed or move those jobs in the on-release workflow

echo "RELEASE_VERSION=${RELEASE_VERSION:1}" >> $GITHUB_ENV
- name: Install doc generation dependencies
run: |
pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Setup doc deploy
run: |
git config --global user.name Docs deploy
git config --global user.email docs@dummy.bot.com
- name: Build mkdocs site in "gh-pages" branch and push
run: |
rm -rf site
VERSION="$RELEASE_VERSION"
ALIAS="latest"
mkdocs build
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
# Set latest version as a default
mike set-default --push latest
- name: Build API docs
run: |
rm -rf api
npm run docs-generateApiDoc
- name: Release API docs to the released version
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api
keep_files: true
destination_dir: ${{ env.RELEASE_VERSION }}/api
- name: Release API docs to the "latest" version
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api
keep_files: true
destination_dir: latest/api
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mike==1.1.2
mkdocs-material==8.0.5
mkdocs-git-revision-date-plugin==0.3.1
Loading