You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.6 KiB
Markdown

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
```