add FUNDING.yml #114
This file contains hidden or 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: Deploy | |
| on: | |
| pull_request: | |
| push: | |
| release: | |
| types: | |
| - released | |
| workflow_dispatch: | |
| env: | |
| AUTH_EMAIL: 30989490+ShineyDev@users.noreply.github.com | |
| AUTH_LOGIN: ShineyDev | |
| AUTH_TOKEN: ${{ secrets.DOCS_TOKEN }} | |
| COMMIT_MESSAGE: update docs for ${{ github.repository }} | |
| PYTHON_VERSION: 3.12 | |
| SPHINX_OPTIONS: -b dirhtml -a -E -n -T -W --keep-going | |
| PULL_INSTALL: -r docs/requirements.txt | |
| PULL_PATH: docs | |
| PUSH_REPOSITORY: ${{ github.repository_owner }}/docs.shiney.dev | |
| PUSH_ROOT_PATH: ${{ github.event.repository.name }} | |
| PUSH_LATEST_PATH: dotcom/latest | |
| PUSH_STABLE_PATH: dotcom/stable | |
| jobs: | |
| job: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout ${{ github.repository }} | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ${{ github.event.repository.name }} | |
| - name: Checkout ${{ env.PUSH_REPOSITORY }} | |
| if: github.repository_owner == 'ShineyDev' && github.event_name != 'pull_request' | |
| uses: actions/checkout@v4 | |
| with: | |
| path: docs | |
| repository: ${{ env.PUSH_REPOSITORY }} | |
| token: ${{ env.AUTH_TOKEN }} | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install | |
| working-directory: ./${{ github.event.repository.name }} | |
| run: |- | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade ${{ env.PULL_INSTALL }} | |
| - name: Build | |
| if: github.event_name == 'pull_request' || ( github.repository_owner != 'ShineyDev' && github.event_name == 'push' ) | |
| run: |- | |
| python -m sphinx ${{ env.SPHINX_OPTIONS }} ./${{ github.event.repository.name }}/${{ env.PULL_PATH }} ./${{ github.event.repository.name }}/${{ env.PULL_PATH }}/build | |
| - name: Build | |
| if: github.repository_owner == 'ShineyDev' && ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) | |
| run: |- | |
| if [ -d ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_LATEST_PATH }} ]; then rm -r ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_LATEST_PATH }}; fi | |
| python -m sphinx ${{ env.SPHINX_OPTIONS }} ./${{ github.event.repository.name }}/${{ env.PULL_PATH }} ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_LATEST_PATH }} | |
| x=${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_LATEST_PATH }}; y=$x; while [ $y != ${y%/*} ]; do y=${y%/*}; echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url='"${x#$y/}"'" /></head><body></body></html>' > ./docs/$y/index.html; done | |
| if [ ! -f ./docs/index.json ]; then echo {} > ./docs/index.json ; fi | |
| jq 'if has("'"${{ env.PUSH_ROOT_PATH }}"'") then (."'"${{ env.PUSH_ROOT_PATH }}"'".latest = "${{ env.PUSH_LATEST_PATH }}" | ."'"${{ env.PUSH_ROOT_PATH }}"'".stable = "${{ env.PUSH_STABLE_PATH }}") else (."'"${{ env.PUSH_ROOT_PATH }}"'" = {latest: "${{ env.PUSH_LATEST_PATH }}", stable: "${{ env.PUSH_STABLE_PATH }}", tags: []}) end' ./docs/index.json > ./docs/temp.json | |
| mv ./docs/temp.json ./docs/index.json | |
| - name: Build | |
| if: github.repository_owner == 'ShineyDev' && github.event_name == 'release' | |
| run: |- | |
| if [ -d ./docs/${{ env.PUSH_ROOT_PATH }}/${{ github.event.release.tag_name }} ]; then rm -r ./docs/${{ env.PUSH_ROOT_PATH }}/${{ github.event.release.tag_name }}; fi | |
| python -m sphinx ${{ env.SPHINX_OPTIONS }} ./${{ github.event.repository.name }}/${{ env.PULL_PATH }} ./docs/${{ env.PUSH_ROOT_PATH }}/${{ github.event.release.tag_name }} | |
| if [ -h ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_STABLE_PATH }} ]; then rm ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_STABLE_PATH }}; fi | |
| ln -s ${{ github.event.release.tag_name }} ./docs/${{ env.PUSH_ROOT_PATH }}/${{ env.PUSH_STABLE_PATH }} | |
| if [ ! -f ./docs/index.json ]; then echo {} > ./docs/index.json ; fi | |
| jq 'if has("'"${{ env.PUSH_ROOT_PATH }}"'") then (."'"${{ env.PUSH_ROOT_PATH }}"'".latest = "${{ env.PUSH_LATEST_PATH }}" | ."'"${{ env.PUSH_ROOT_PATH }}"'".stable = "${{ env.PUSH_STABLE_PATH }}" | ."'"${{ env.PUSH_ROOT_PATH }}"'".tags |= . + ["${{ github.event.release.tag_name }}"]) else (."'"${{ env.PUSH_ROOT_PATH }}"'" = {latest: "${{ env.PUSH_LATEST_PATH }}", stable: "${{ env.PUSH_STABLE_PATH }}", tags: ["${{ github.event.release.tag_name }}"]}) end' ./docs/index.json > ./docs/temp.json | |
| mv ./docs/temp.json ./docs/index.json | |
| - name: Push | |
| if: github.repository_owner == 'ShineyDev' && github.event_name != 'pull_request' | |
| continue-on-error: true | |
| working-directory: docs | |
| run: |- | |
| git config user.name ${{ env.AUTH_LOGIN }} | |
| git config user.email ${{ env.AUTH_EMAIL }} | |
| git add . | |
| git commit -m "${{ env.COMMIT_MESSAGE }}" | |
| git push |