diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 475ae42..e21fca9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -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 ) diff --git a/Makefile b/Makefile index 9af71c3..4567096 100644 --- a/Makefile +++ b/Makefile @@ -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