github.com/go-swagger/go-swagger@v0.31.0/.github/workflows/update-doc.yaml (about) 1 name: "Update documentation" 2 3 on: 4 push: 5 tags: 6 - v* 7 branches: [ "master" ] 8 paths: 9 - docs/** 10 - hack/doc-site/** 11 - .github/workflows/update-doc.yaml 12 13 pull_request_target: 14 paths: 15 - docs/** 16 - hack/doc-site/** 17 - .github/workflows/update-doc.yaml 18 19 permissions: 20 contents: read 21 pages: write 22 id-token: write 23 24 concurrency: 25 group: "pages" 26 cancel-in-progress: false 27 28 defaults: 29 run: 30 shell: bash 31 32 jobs: 33 build-doc: 34 runs-on: ubuntu-latest 35 steps: 36 - 37 name: Checkout 38 uses: actions/checkout@v4 39 with: 40 fetch-depth: '1' 41 #fetch-tags: 'true' 42 submodules: recursive 43 sparse-checkout: | 44 hack/ 45 docs/ 46 47 - name: Get all tags 48 run: git fetch --prune --unshallow --tags 49 50 - 51 name: Initialize themes 52 run: | 53 (cd hack/doc-site/hugo/ && git clone https://github.com/alex-shpak/hugo-book themes/hugo-book) 54 55 - 56 name: Prepare config 57 run: | 58 # Builds a commit-dependant extra config to inject parameterization. 59 # HUGO doesn't support config from the command line. 60 # 61 # Set go-swagger specific parameters that are used in some parameterized documents 62 # This is used to keep up-to-date installation instructions. 63 cd hack/doc-site/hugo 64 LATEST_RELEASE=$(git describe --tags --abbrev=0) 65 VERSION_MESSAGE="Documentation set for latest master." 66 ROOT=$(git rev-parse --show-toplevel) 67 REQUIRED_GO_VERSION=$(grep "^go\s" "${ROOT}"/go.mod|cut -d" " -f2) 68 printf \ 69 "params:\n goswagger:\n goVersion: '%s'\n latestRelease: '%s'\n versionMessage: '%s'\n" \ 70 "${REQUIRED_GO_VERSION}" "${LATEST_RELEASE}" "${VERSION_MESSAGE}" > goswagger.yaml 71 72 - 73 name: Build site with Hugo 74 uses: crazy-max/ghaction-hugo@v3 75 with: 76 version: v0.123.8 # <- pin the HUGO version, at they often break things 77 extended: true 78 args: > 79 --config hugo.yaml,goswagger.yaml 80 --buildDrafts 81 --cleanDestinationDir 82 --minify 83 --printPathWarnings 84 --ignoreCache 85 --noBuildLock 86 --logLevel info 87 --source ${{ github.workspace }}/hack/doc-site/hugo" 88 89 - 90 name: Upload artifact 91 uses: actions/upload-pages-artifact@v3 92 with: 93 path: hack/doc-site/hugo/public 94 95 deploy-doc: 96 if: ${{ github.event_name != 'pull_request_target' }} 97 environment: 98 name: github-pages 99 url: ${{ steps.deployment.outputs.page_url }} 100 runs-on: ubuntu-latest 101 needs: build-doc 102 steps: 103 - name: Deploy to GitHub Pages 104 id: deployment 105 uses: actions/deploy-pages@v4