|
4 | 4 | branches: [ "develop" ] |
5 | 5 | pull_request: |
6 | 6 | branches: [ "develop" ] |
| 7 | + workflow_dispatch: |
7 | 8 |
|
8 | 9 | jobs: |
9 | 10 | htmltest: |
10 | 11 | runs-on: ubuntu-latest |
| 12 | + env: |
| 13 | + HUGO_CACHE_HOST_DIR: ./.hugo_cache |
| 14 | + HUGO_CACHE_CONTAINER_DIR: /src/.hugo_cache |
11 | 15 | steps: |
12 | 16 | - uses: actions/checkout@v4 |
13 | | - |
14 | | - - name: Read .env hugo version |
15 | | - id: hugo-version |
16 | | - run: | |
17 | | - . ./.env |
18 | | - echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}" |
19 | | - echo "::set-output name=DOCSY_VERSION::${DOCSY_VERSION}" |
20 | | -
|
21 | | - - name: Add hugo nodejs dependencies |
22 | | - uses: actions/setup-node@v4 |
23 | 17 | with: |
24 | | - node-version: "18" |
25 | | - cache: 'npm' |
| 18 | + fetch-depth: 0 |
26 | 19 |
|
27 | | - - name: Setup Hugo |
28 | | - uses: peaceiris/actions-hugo@v3 |
29 | | - with: |
30 | | - # sync versions with docker-compose .env ala |
31 | | - # https://github.com/marketplace/actions/hugo-setup#%EF%B8%8F-read-hugo-version-from-file |
32 | | - hugo-version: "${{ steps.hugo-version.outputs.HUGO_VERSION }}" |
33 | | - extended: true |
34 | | - |
35 | | - - name: Build Hugo site |
| 20 | + - name: Build Hugo site in Docker Compose |
36 | 21 | env: |
37 | 22 | HUGO_ENV: "production" |
38 | 23 | run: | |
39 | | - npm install |
40 | | - hugo --minify --gc -d $GITHUB_WORKSPACE/dist |
| 24 | + docker compose build --pull hugo |
| 25 | + docker compose run --rm --no-deps \ |
| 26 | + --entrypoint sh \ |
| 27 | + --user "$(id -u):$(id -g)" \ |
| 28 | + -e HOME=/tmp \ |
| 29 | + -e npm_config_cache=/tmp/.npm \ |
| 30 | + -e HUGO_CACHEDIR="${HUGO_CACHE_CONTAINER_DIR}" \ |
| 31 | + -e HUGO_ENV="${HUGO_ENV}" \ |
| 32 | + hugo -lc 'git config --global --add safe.directory /src && git config --global core.quotepath false && hugo build --gc --minify --cacheDir "${HUGO_CACHEDIR}" -d /src/dist' |
| 33 | +
|
41 | 34 | - name: run htmltest |
42 | 35 | continue-on-error: true |
43 | 36 | uses: wjdp/htmltest-action@master |
44 | 37 | with: |
45 | 38 | config: .htmltest.yml |
| 39 | + |
46 | 40 | - name: archive htmltest results |
| 41 | + if: always() |
47 | 42 | uses: actions/upload-artifact@v4 |
48 | 43 | with: |
49 | 44 | name: htmltest-report |
50 | | - path: tmp/.htmltest/htmltest.log |
| 45 | + path: tmp/.htmltest/ |
51 | 46 | retention-days: 5 |
0 commit comments