Git hook triggered via local commit or Gitea's one. It runs Hugo against its dedicated repository with Markdown files and related assets.
Find a file
2020-12-02 17:37:23 +01:00
vendor initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00
go.mod initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00
go.sum initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00
main.go initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00
README.md minor 2020-12-02 17:37:23 +01:00
sphook initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00

this repo was initialized and `sphook` binary built like this:
```
go mod init main
go mod vendor
go build -o sphook .
```

the `sphook` executable in the root repo is built on linux 64bits computer. it should work on common linux x86_64 virtual server or common linux x86_64 bare metal computer.

it has hardcoded filepath for Hugo's final output directory:

```
/var/www/html/sandpoints
```

it should work for two scenarios:  
- _bare_ git repository and in our case we always run it against the `gitea` instances (git web frontend).
- _working_ git repository and in our case that's usually a git repository running on some local instance (e.g. developer's laptop)

1) in _bare_ git repository scenario it should work as a post-receive hook
2) in _working_ git repository scenario it should work as a post-commit hook

regarding scenarion `sphook` will be renamed into `.git/hooks/post-commit`, `gitea_repo.git/hooks/post-received.d/sphook` or whatever is prepared/set in `.git/hooks` directory to trigger an executable after the specific hook.

its task is simple: it takes content from `content/` directory and run `hugo` against it. it places the output into:

```
/var/www/html/sandpoints/{hugo_project_name}-{`crc32.ChecksumIEEE(git_repo_path)`}
```

it is good to check out the logs of git commit in order to find the path of that directory. once that's done logs will be placed in both:
```
/var/www/html/sandpoints/{hugo_project_name}-{`crc32.ChecksumIEEE(git_repo_path)`}/last-commit-log.txt

/var/www/html/sandpoints/{hugo_project_name}-{`crc32.ChecksumIEEE(git_repo_path)`}/_preview/last-commit-log.txt
```