task-admin: Add remote section #551
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: Build-docs | |
on: | |
push: | |
pull_request: | |
jobs: | |
build_job: | |
runs-on: ubuntu-latest | |
name: Build documentation | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install native dependencies | |
run: sudo apt-get update -y && sudo apt-get install -y ditaa graphviz python3-setuptools | |
- name: Install pip dependencies | |
run: sudo pip3 install -r requirements.txt | |
- name: Build documentation | |
run: make html | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: docs | |
path: build | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/Sergiu121/sergiu121.github.io.git github-pages | |
if test ${{ github.ref}} == 'refs/heads/master'; then | |
cp -r build/html/* github-pages/docs | |
else | |
mkdir -p github-pages/${{ github.ref }} | |
cp -r build/html/* github-pages/${{ github.ref }} | |
fi | |
cd github-pages/ | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m 'Update "${{ github.ref }}"' -a || true | |
#git remote set-url origin https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/${{ github.repository }} | |
git push https://${{ secrets.ACCESS_TOKEN }}@github.com/Sergiu121/sergiu121.github.io.git | |
# The above command will fail if no changes were present, so we ignore | |
# that. | |
- name: Add comment to PR | |
if: github.event_name == 'pull_request' | |
env: | |
URL: ${{ github.event.pull_request.comments_url }} | |
GITHUB_TOKEN: sergiu121:${{ secrets.ACCESS_TOKEN }} | |
run: | | |
curl \ | |
-X POST \ | |
-u $GITHUB_TOKEN \ | |
$URL \ | |
-H "Content-Type: application/json" \ | |
--data '{ "body": "Published at http://sergiu121.github.io/${{ github.ref }}" }' |