|
| 1 | +name: publish-docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + # At this day, GitHub doesn't support YAML anchors, d'oh! |
| 8 | + paths: |
| 9 | + - "docs/**" |
| 10 | + - "docsgen/**" |
| 11 | + - "cli/**" |
| 12 | + - "rpc/**" |
| 13 | + - ".github/workflows/publish-docs.yaml" |
| 14 | + |
| 15 | +jobs: |
| 16 | + publish: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v2 |
| 22 | + |
| 23 | + - name: Install Taskfile |
| 24 | + uses: Arduino/actions/setup-taskfile@master |
| 25 | + with: |
| 26 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + - name: Setup Go |
| 29 | + uses: actions/setup-go@v2 |
| 30 | + with: |
| 31 | + go-version: "1.14" |
| 32 | + |
| 33 | + - name: Install Go dependencies |
| 34 | + run: | |
| 35 | + go version |
| 36 | + go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc |
| 37 | +
|
| 38 | + - name: Install protoc compiler |
| 39 | + uses: arduino/setup-protoc@v1 |
| 40 | + with: |
| 41 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + |
| 43 | + - name: Setup Python |
| 44 | + uses: actions/setup-python@v1 |
| 45 | + with: |
| 46 | + python-version: "3.8" |
| 47 | + architecture: "x64" |
| 48 | + |
| 49 | + - name: Cache dependencies |
| 50 | + uses: actions/cache@v1 |
| 51 | + with: |
| 52 | + path: ~/.cache/pip |
| 53 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 54 | + restore-keys: | |
| 55 | + ${{ runner.os }}-pip- |
| 56 | +
|
| 57 | + - name: Install Python dependencies |
| 58 | + run: | |
| 59 | + python3 -m pip install --upgrade pip |
| 60 | + python3 -m pip install -r ./requirements_docs.txt |
| 61 | +
|
| 62 | + - name: Publish docs |
| 63 | + # Determine docs version for the commit pushed and publish accordingly using Mike. |
| 64 | + # Publishing implies creating a git commit on the gh-pages branch, we let |
| 65 | + # ArduinoBot own these commits. |
| 66 | + run: | |
| 67 | + git config --global user.email "[email protected]" |
| 68 | + git config --global user.name "ArduinoBot" |
| 69 | + git fetch --no-tags --prune --depth=1 origin +refs/heads/gh-pages:refs/remotes/origin/gh-pages |
| 70 | + python docs/build.py |
0 commit comments