Push documentation to docs repo #44
Workflow file for this run
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: Push documentation to docs repo | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- v* | |
jobs: | |
build-and-push-to-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.API_TOKEN_GITHUB }} | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14.x' | |
- run: npm install -g widdershins | |
- name: Convert openapi JSON to MD | |
run: | | |
# Convert json to md | |
widdershins docs/openapi.json -o docs/openapi.md | |
# Remove lines with pattern '*backwards compatibility*' (problematic with Docusaurus) | |
sed -i '/backwards compatibility/d' docs/openapi.md | |
rm -f docs/openapi.json | |
- name: Install envsubst | |
run: | | |
sudo apt update | |
sudo apt install -y gettext | |
- name: Download push-to-docs script template | |
run: | | |
curl -o push-to-docs.sh.template https://raw.githubusercontent.com/nevermined-io/reusable-workflows/main/scripts/push-to-docs.sh | |
- name: Replace env vars in push-to-docs script | |
env: | |
BRANCH_TO_CLONE: main | |
REPO_TO_PUSH: nvm-docs | |
PATH_TO_COPY: docs/ | |
PATH_TO_PUSH: docs/architecture/components/marketplace-api | |
REPOSITORY_NAME: ${{ github.repository }} | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
run: | | |
export REPOSITORY_NAME=$(echo $REPOSITORY_NAME | awk -F '/' '{print $2}') | |
envsubst < push-to-docs.sh.template > push-to-docs.sh | |
env > env.file | |
chmod +x push-to-docs.sh | |
./push-to-docs.sh |