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