|
1 |
| -name: Push to GitHub Pages on push to main |
| 1 | +# Sample workflow for building and deploying a Hugo site to GitHub Pages |
| 2 | +name: Deploy Hugo site to Pages |
| 3 | + |
2 | 4 | on:
|
| 5 | + # Runs on pushes targeting the default branch |
3 | 6 | push:
|
4 | 7 | branches:
|
5 | 8 | - main
|
6 | 9 |
|
| 10 | + # Allows you to run this workflow manually from the Actions tab |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + pages: write |
| 17 | + id-token: write |
| 18 | + |
| 19 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 20 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 21 | +concurrency: |
| 22 | + group: "pages" |
| 23 | + cancel-in-progress: false |
| 24 | + |
| 25 | +# Default to bash |
| 26 | +defaults: |
| 27 | + run: |
| 28 | + shell: bash |
| 29 | + |
7 | 30 | jobs:
|
| 31 | + # Build job |
8 | 32 | build:
|
9 |
| - name: Deploy |
10 | 33 | runs-on: ubuntu-latest
|
| 34 | + env: |
| 35 | + HUGO_VERSION: 0.115.1 |
11 | 36 | steps:
|
12 |
| - - name: Checkout code |
13 |
| - uses: actions/checkout@v1 |
14 |
| - |
15 |
| - - name: Deploy the site |
16 |
| - uses: benmatselby/hugo-deploy-gh-pages@main |
| 37 | + - name: Install Hugo CLI |
| 38 | + run: | |
| 39 | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ |
| 40 | + && sudo dpkg -i ${{ runner.temp }}/hugo.deb |
| 41 | + - name: Install Dart Sass |
| 42 | + run: sudo snap install dart-sass |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v3 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + fetch-depth: 0 |
| 48 | + - name: Setup Pages |
| 49 | + id: pages |
| 50 | + uses: actions/configure-pages@v3 |
| 51 | + - name: Install Node.js dependencies |
| 52 | + run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" |
| 53 | + - name: Build with Hugo |
17 | 54 | env:
|
18 |
| - HUGO_VERSION: 0.88.0 |
19 |
| - TARGET_REPO: IndieCrew-Studio/IndieCrew-Studio.github.io |
20 |
| - TARGET_BRANCH: main |
21 |
| - TOKEN: ${{ secrets.TOKEN }} |
22 |
| - HUGO_ARGS: '-t academic' |
23 |
| - CNAME: IndieCrew-Studio.github.io |
| 55 | + # For maximum backward compatibility with Hugo modules |
| 56 | + HUGO_ENVIRONMENT: production |
| 57 | + HUGO_ENV: production |
| 58 | + run: | |
| 59 | + hugo \ |
| 60 | + --gc \ |
| 61 | + --minify \ |
| 62 | + --baseURL "${{ steps.pages.outputs.base_url }}/" |
| 63 | + - name: Upload artifact |
| 64 | + uses: actions/upload-pages-artifact@v1 |
| 65 | + with: |
| 66 | + path: ./public |
| 67 | + - name: Push to GitHub Pages branch |
| 68 | + |
| 69 | + |
| 70 | + with: |
| 71 | + build_dir: public |
| 72 | + github_token: ${{ secrets.TOKEN }} |
| 73 | + |
| 74 | + |
| 75 | + # Deployment job |
| 76 | + deploy: |
| 77 | + environment: |
| 78 | + name: github-pages |
| 79 | + url: ${{ steps.deployment.outputs.page_url }} |
| 80 | + runs-on: ubuntu-latest |
| 81 | + needs: build |
| 82 | + steps: |
| 83 | + - name: Checkout |
| 84 | + uses: actions/checkout@v3 |
| 85 | + with: |
| 86 | + fetch-depth: 0 |
| 87 | + - name: Deploy to GitHub Pages |
| 88 | + id: deployment |
| 89 | + uses: actions/deploy-pages@v2 |
0 commit comments