|
1 | | -name: Build GH-Pages |
| 1 | +name: Deploy Hugo PaperMod Demo to Pages |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
17 | 17 | required: false |
18 | 18 | default: "0.83.0" |
19 | 19 |
|
| 20 | +# Allow one concurrent deployment |
| 21 | +concurrency: |
| 22 | + group: "pages" |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +# Default to bash |
| 26 | +defaults: |
| 27 | + run: |
| 28 | + shell: bash |
| 29 | + |
| 30 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 31 | +permissions: |
| 32 | + contents: read |
| 33 | + pages: write |
| 34 | + id-token: write |
| 35 | + |
20 | 36 | jobs: |
21 | | - deploy: |
| 37 | + # Build job |
| 38 | + build: |
22 | 39 | runs-on: ubuntu-latest |
| 40 | + env: |
| 41 | + HUGO_VERSION: "0.83.0" |
23 | 42 | steps: |
24 | | - - name: Git checkout |
25 | | - uses: actions/checkout@v2 |
| 43 | + - name: Check version |
| 44 | + if: ${{ github.event.inputs.hugoVersion }} |
| 45 | + run: export HUGO_VERSION="${{ github.event.inputs.hugoVersion }}" |
| 46 | + - name: Install Hugo CLI |
| 47 | + run: | |
| 48 | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb \ |
| 49 | + && sudo dpkg -i ${{ runner.temp }}/hugo.deb |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v3 |
26 | 52 | with: |
27 | 53 | ref: exampleSite |
28 | | - |
| 54 | + - name: Setup Pages |
| 55 | + id: pages |
| 56 | + uses: actions/configure-pages@v1 |
29 | 57 | - name: Get Theme |
30 | 58 | run: git submodule update --init --recursive |
31 | | - |
32 | 59 | - name: Update theme to Latest commit |
33 | 60 | run: git submodule update --remote --merge |
34 | | - |
35 | | - - name: Setup hugo |
36 | | - uses: peaceiris/actions-hugo@v2 |
| 61 | + - name: Build with Hugo |
| 62 | + run: | |
| 63 | + hugo \ |
| 64 | + --buildDrafts --gc --verbose \ |
| 65 | + --baseURL ${{ steps.pages.outputs.base_url }} |
| 66 | + - name: Upload artifact |
| 67 | + uses: actions/upload-pages-artifact@v1 |
37 | 68 | with: |
38 | | - hugo-version: "${{ github.event.inputs.hugoVersion }}" |
39 | | - |
40 | | - - name: Build |
41 | | - run: hugo --buildDrafts --gc --verbose --minify |
42 | | - |
43 | | - - name: Deploy |
44 | | - uses: peaceiris/actions-gh-pages@v3 |
45 | | - with: |
46 | | - github_token: ${{ secrets.TOKEN }} |
47 | | - publish_dir: ./public |
| 69 | + path: ./public |
| 70 | + # Deployment job |
| 71 | + deploy: |
| 72 | + environment: |
| 73 | + name: github-pages |
| 74 | + url: ${{ steps.deployment.outputs.page_url }} |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: build |
| 77 | + steps: |
| 78 | + - name: Deploy to GitHub Pages |
| 79 | + id: deployment |
| 80 | + uses: actions/deploy-pages@v1 |
0 commit comments