Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Make commit message dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
bijij committed May 18, 2021
1 parent 67adb4f commit b807119
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
AUTH_LOGIN: ShineyDev
AUTH_TOKEN: ${{ secrets.DOCS_TOKEN }}

COMMIT_MESSAGE: update docs for ${{ github.repository }}

PULL_INSTALL: .[docs]
PULL_PATH: docs

Expand Down Expand Up @@ -49,17 +51,15 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade ${{ env.PULL_INSTALL }}
- name: Build
if: ${{ github.event_name == 'push' }}
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_STABLE_PATH }}", stable: "${{ env.PUSH_STABLE_PATH }}", tags: []}) end' ./docs/index.json > ./docs/temp.json
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.event_name == 'release' }}
run: |
Expand All @@ -68,15 +68,14 @@ jobs:
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_STABLE_PATH }}", stable: "${{ env.PUSH_STABLE_PATH }}", tags: ["${{ github.event.release.tag_name }}"]}) end' ./docs/index.json > ./docs/temp.json
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
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 "update docs for ${{ github.repository }}"
git commit -m "${{ env.COMMIT_MESSAGE }}"
git push

0 comments on commit b807119

Please sign in to comment.