hugo-gh-pages.yml (1563B)
1 name: Deploy theme example site to GitHub Pages 2 3 on: 4 push: 5 branches: 6 - main 7 paths: 8 - "example/**" 9 - "layouts/**" 10 - "assets/**" 11 - "static/**" 12 - "hugo.json" 13 - ".github/workflows/hugo-gh-pages.yml" 14 workflow_dispatch: 15 16 permissions: 17 contents: read 18 pages: write 19 id-token: write 20 21 concurrency: 22 group: "hugo-theme-example" 23 cancel-in-progress: true 24 25 jobs: 26 build: 27 runs-on: ubuntu-latest 28 29 steps: 30 - name: Setup Hugo 31 uses: peaceiris/actions-hugo@v3 32 with: 33 hugo-version: "latest" 34 extended: true 35 36 - name: Create temporary Hugo site 37 run: | 38 hugo new site site-tmp 39 rm -rf site-tmp/hugo.* 40 cd site-tmp 41 git init 42 git submodule add "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" themes/yamt 43 cd .. 44 45 - name: Copy example site into temp site 46 run: | 47 cp -r site-tmp/themes/yamt/example/* site-tmp/ 48 49 - name: Build Hugo (from temp site) 50 working-directory: site-tmp 51 run: | 52 ls -R content/ themes/ 53 hugo --baseURL https://ckiri.github.io/yamt/ --minify 54 55 - name: Upload Pages artifact 56 uses: actions/upload-pages-artifact@v3 57 with: 58 path: site-tmp/public 59 60 deploy: 61 environment: 62 name: github-pages 63 url: ${{ steps.deployment.outputs.page_url }} 64 runs-on: ubuntu-latest 65 needs: build 66 67 steps: 68 - name: Deploy to GitHub Pages 69 id: deployment 70 uses: actions/deploy-pages@v4