test #67
Workflow file for this run
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: "Update documentation TEST" | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: [ "master" ] | ||
paths: | ||
- docs/** | ||
- hack/doc-site/** | ||
- .github/workflows/update-doc.yaml | ||
pull_request_target: | ||
paths: | ||
- docs/** | ||
- hack/doc-site/** | ||
- .github/workflows/update-doc.yaml | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
build-doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '1' | ||
#fetch-tags: 'true' | ||
submodules: recursive | ||
sparse-checkout: | | ||
hack/ | ||
docs/ | ||
- name: Get all tags | ||
run: git fetch --prune --unshallow --tags | ||
- | ||
name: Initialize themes | ||
run: | | ||
(cd hack/doc-site/hugo/ && git clone https://github.com/alex-shpak/hugo-book themes/hugo-book) | ||
- | ||
name: Prepare config | ||
run: | | ||
# Builds a commit-dependant extra config to inject parameterization. | ||
# HUGO doesn't support config from the command line. | ||
# | ||
# Set go-swagger specific parameters that are used in some parameterized documents | ||
# This is used to keep up-to-date installation instructions. | ||
cd hack/doc-site/hugo | ||
LATEST_RELEASE=$(git describe --tags --abbrev=0) | ||
VERSION_MESSAGE="Documentation set for latest master." | ||
ROOT=$(git rev-parse --show-toplevel) | ||
REQUIRED_GO_VERSION=$(grep "^go\s" "${ROOT}"/go.mod|cut -d" " -f2) | ||
printf \ | ||
"params:\n goswagger:\n goVersion: '%s'\n latestRelease: '%s'\n versionMessage: '%s'\n" \ | ||
"${REQUIRED_GO_VERSION}" "${LATEST_RELEASE}" "${VERSION_MESSAGE}" > goswagger.yaml | ||
- | ||
name: Build site with Hugo | ||
uses: crazy-max/ghaction-hugo@v3 | ||
with: | ||
version: v0.123.8 # <- pin the HUGO version, at they often break things | ||
extended: true | ||
args: > | ||
--config hugo.yaml,goswagger.yaml | ||
--buildDrafts | ||
--cleanDestinationDir | ||
--minify | ||
--printPathWarnings | ||
--ignoreCache | ||
--noBuildLock | ||
--logLevel info | ||
--source ${{ github.workspace }}/hack/doc-site/hugo" | ||
- | ||
name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: hack/doc-site/hugo/public | ||
- | ||
name: Debug | ||
run: | | ||
echo "${{ github.event_name }}" | ||
echo "${{ github.event.action }}" | ||
deploy-doc: | ||
if: ${{ github.event_name != 'pull_request_target' }} | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build-doc | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |