Generate pages #12
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: Generate pages | |
| # Based on | |
| # https://blog.benhpoh.com/2022/01/21/trigger-another-github-repos-workflow/ | |
| # https://lannonbr.com/blog/2019-12-09-git-commit-in-actions/ | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| hugoVersion: | |
| description: 'Hugo version to use to generate site.' | |
| required: false | |
| default: '0.115.4' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| steps: | |
| - name: Checkout blog | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: 'inianv/blog' | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Checkout inianv.github.io | |
| uses: actions/checkout@v3 | |
| with: | |
| path: public | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: "${{ github.event.inputs.logLevel }}" | |
| - name: Generate | |
| run: hugo --minify | |
| - name: Add changes and commit | |
| run: | | |
| COMMIT_MSG=$(git log -1 --pretty=format:"%s") | |
| cd public | |
| git add -vA | |
| git config user.name "GitHub Actions" | |
| git config user.email "github-actions@github.com" | |
| git commit -m "${COMMIT_MSG}" && git push -u origin main || echo |