|
1 | | -name: Publish Site |
| 1 | +name: Deploy Hugo site to Pages |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [master] |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + pages: write |
| 13 | + id-token: write |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: "pages" |
| 17 | + cancel-in-progress: false |
| 18 | + |
| 19 | +defaults: |
| 20 | + run: |
| 21 | + shell: bash |
6 | 22 |
|
7 | 23 | jobs: |
8 | | - build-deploy: |
| 24 | + build: |
9 | 25 | runs-on: ubuntu-latest |
| 26 | + env: |
| 27 | + HUGO_VERSION: 0.145.0 |
| 28 | + HUGO_ENVIRONMENT: production |
10 | 29 | steps: |
11 | | - - name: Checkout repository |
12 | | - uses: actions/checkout@master |
13 | | - |
14 | | - - name: Build site |
15 | | - uses: ./ |
16 | | - |
17 | | - - name: Deploy to GH-Pages |
18 | | - uses: peaceiris/actions-gh-pages@v3 |
| 30 | + - name: Install Hugo CLI |
| 31 | + run: | |
| 32 | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ |
| 33 | + && sudo dpkg -i ${{ runner.temp }}/hugo.deb |
| 34 | + - name: Install Dart Sass |
| 35 | + run: sudo snap install dart-sass |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + submodules: recursive |
| 40 | + fetch-depth: 0 |
| 41 | + - name: Setup Pages |
| 42 | + id: pages |
| 43 | + uses: actions/configure-pages@v5 |
| 44 | + - name: Cache Restore |
| 45 | + id: cache-restore |
| 46 | + uses: actions/cache/restore@v4 |
19 | 47 | with: |
20 | | - github_token: ${{ secrets.DEPLOY_TOKEN }} |
21 | | - publish_dir: ./public |
| 48 | + path: | |
| 49 | + ${{ runner.temp }}/hugo_cache |
| 50 | + key: hugo-${{ github.run_id }} |
| 51 | + restore-keys: |
| 52 | + hugo- |
| 53 | + - name: Build diagrams |
| 54 | + run: make |
| 55 | + with: |
| 56 | + file: ./Dockerfile |
| 57 | + - name: Build with Hugo |
| 58 | + run: | |
| 59 | + hugo \ |
| 60 | + --gc \ |
| 61 | + --minify \ |
| 62 | + --baseURL "${{ steps.pages.outputs.base_url }}/" \ |
| 63 | + --cacheDir "${{ runner.temp }}/hugo_cache" |
| 64 | + - name: Cache Save |
| 65 | + id: cache-save |
| 66 | + uses: actions/cache/save@v4 |
| 67 | + with: |
| 68 | + path: | |
| 69 | + ${{ runner.temp }}/hugo_cache |
| 70 | + key: ${{ steps.cache-restore.outputs.cache-primary-key }} |
| 71 | + - name: Upload artifact |
| 72 | + uses: actions/upload-pages-artifact@v3 |
| 73 | + with: |
| 74 | + path: ./public |
| 75 | + |
| 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: Deploy to GitHub Pages |
| 84 | + id: deployment |
| 85 | + uses: actions/deploy-pages@v4 |
0 commit comments