Only push if docs changed

This commit is contained in:
eikendev 2021-11-01 23:53:13 +01:00
parent a8e93f1762
commit 0685518efe
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
2 changed files with 15 additions and 4 deletions

View file

@ -23,14 +23,19 @@ jobs:
with:
ref: ${{ github.head_ref }}
- name: Install swag
run: go install github.com/swaggo/swag/cmd/swag
- name: Export GOBIN
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Install dependencies
run: make setup
- name: Install redoc
run: sudo apt install npm && sudo npm install redoc
- name: Build the API documentation
run: /home/runner/go/bin/swag init --parseDependency=true -d . -g cmd/pushbits/main.go
run: make swag
- name: Build static HTML
run: npx redoc-cli bundle docs/swagger.yaml --output index.html
@ -56,4 +61,6 @@ jobs:
- name: Commit and push
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: cd website && git add . && git commit -m "Update documentation to ${{ github.sha }}" && git push
run: |
cd website
git diff --quiet || ( git add . && git commit -m "Update documentation to ${{ github.sha }}" && git push )

View file

@ -19,3 +19,7 @@ setup:
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install github.com/swaggo/swag/cmd/swag@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
.PHONY: swag
swag:
swag init --parseDependency=true -d . -g cmd/pushbits/main.go