|
81 | 81 | verbose: true
|
82 | 82 | fail_ci_if_error: false
|
83 | 83 | name: '${{env.CODECOV_UNIQUE_NAME}}'
|
| 84 | + |
| 85 | + Generate-Documentation: |
| 86 | + name: Generate Documentation |
| 87 | + runs-on: ubuntu-latest |
| 88 | + if: github.ref == 'refs/heads/automated-docs' |
| 89 | + needs: Push-Workflow |
| 90 | + steps: |
| 91 | + - name: Checkout repository |
| 92 | + uses: actions/checkout@v3 |
| 93 | + |
| 94 | + - name: Generate Documentation of HTML pages |
| 95 | + run: | |
| 96 | + npm install --global typedoc |
| 97 | + npm install typedoc-plugin-markdown |
| 98 | + npm i --save-dev @types/node |
| 99 | + npx typedoc --entryPoints src --out talawa-api-docs --plugin typedoc-plugin-markdown --theme markdown --entryPointStrategy expand |
| 100 | + |
| 101 | + - name: Checking doc updated |
| 102 | + id: DocUpdated |
| 103 | + run: | |
| 104 | + if [ -n "$(git status --porcelain)" ]; then |
| 105 | + echo "updateDoc=true" >> $GITHUB_OUTPUT |
| 106 | + echo -e "Documentation has been updated!!" |
| 107 | + else |
| 108 | + Green='0;32' |
| 109 | + NoColor='\033[0m' |
| 110 | + echo -e "${Green}No documentation updated${NoColor}" |
| 111 | + fi |
| 112 | + |
| 113 | + - name: Set env variables |
| 114 | + if: steps.DocUpdated.outputs.updateDoc |
| 115 | + run: | |
| 116 | + echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV |
| 117 | + echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV |
| 118 | + |
| 119 | + - name: Update Doc |
| 120 | + if: steps.DocUpdated.outputs.updateDoc |
| 121 | + run: | |
| 122 | + Green='0;32' |
| 123 | + NoColor='\033[0m' |
| 124 | + git config --global user.name "${{github.actor}}" |
| 125 | + git config --global user.email "${{env.email}}" |
| 126 | + git add . |
| 127 | + git commit -m "Update documentation" |
| 128 | + git push |
| 129 | + echo -e "🚀${Green} Hurrah! doc updated${NoColor}" |
| 130 | + |
| 131 | + - name: Create Documentation Artifact |
| 132 | + uses: actions/upload-artifact@v2 |
| 133 | + with: |
| 134 | + name: documentation-api |
| 135 | + path: talawa-api-docs |
| 136 | + |
| 137 | + Copy-docs-to-talawa-docs: |
| 138 | + runs-on: ubuntu-latest |
| 139 | + if: github.ref == 'refs/heads/automated-docs' |
| 140 | + needs: Generate-Documentation |
| 141 | + steps: |
| 142 | + - uses: actions/checkout@v3 |
| 143 | + |
| 144 | + env: |
| 145 | + API_TOKEN_GITHUB: ${{ secrets.TALAWA_DOCS_SYNC }} |
| 146 | + with: |
| 147 | + source_file: 'talawa-api-docs/' |
| 148 | + destination_repo: 'PalisadoesFoundation/talawa-docs' |
| 149 | + destination_branch: 'testing-workflows' |
| 150 | + destination_folder: 'docs/' |
| 151 | + user_email: '${{env.email}}' |
| 152 | + user_name: '${{github.actor}}' |
| 153 | + commit_message: 'Talawa API docs updated' |
| 154 | + |
0 commit comments