Skip to content

Commit

Permalink
Fix build with --enableGitInfo (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Oct 24, 2023
1 parent 375431d commit b14f4b5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ jobs:
contains(fromJson('["", "git-", "node-git", "go-git", "exts-"]'), matrix.prefix)
run: docker run --rm ${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}${{ matrix.prefix }}test git version

- name: Test site build with --enableGitInfo
if: |
steps.check.outputs.exists == 'false' &&
contains(fromJson('["", "git-", "node-git", "go-git", "exts-"]'), matrix.prefix)
run: docker run --rm ${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}${{ matrix.prefix }}test hugo --enableGitInfo

- name: Check Go installation
if: |
steps.check.outputs.exists == 'false' &&
Expand Down
2 changes: 2 additions & 0 deletions docker/hugo/snippets/git
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
RUN apk add --no-cache git

RUN git config --global --add safe.directory /src
1 change: 1 addition & 0 deletions site/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<head>
<title>{{ .Page.Title }}</title>
{{ partial "dart-sass" . }}
{{ partial "git" . }}
</head>
<body>
{{ partial "get-remote" . }}
Expand Down
3 changes: 3 additions & 0 deletions site/layouts/partials/git.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- with .GitInfo }}
{{- warnf "[git] %s: %s" .Hash .Subject }}
{{- end }}

0 comments on commit b14f4b5

Please sign in to comment.