Update website workflow to get the directory structure correct for th… #3
This file contains hidden or 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: website | |
| ## https://github.com/peaceiris/actions-hugo | |
| ## https://github.com/github-actions-x/hugo | |
| ## https://github.com/github-actions-x/commit | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| if: github.repository == 'cpanel/elevate' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true # Fetch Hugo themes (true OR recursive) | |
| fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
| persist-credentials: false | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: "0.91.2" | |
| - name: Build | |
| working-directory: ./docs-website-src | |
| run: | | |
| hugo -D | |
| - name: check delta | |
| run: | | |
| git status | |
| git diff | |
| - name: push | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| pubdir="$(mktemp -d)" | |
| mkdir -p "$pubdir/docs" | |
| cp -a docs/. "$pubdir/docs/" | |
| touch "$pubdir/.nojekyll" | |
| cd "$pubdir" | |
| git init -q | |
| git checkout -B docs | |
| git -c user.email=github.bot@webpros.com \ | |
| -c user.name='GitHub Action' \ | |
| add -A | |
| git -c user.email=github.bot@webpros.com \ | |
| -c user.name='GitHub Action' \ | |
| commit -m 'Regenerate Documentation Website' | |
| git push --force \ | |
| "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}" \ | |
| docs |