Git hook triggered via local commit or Gitea's one. It runs Hugo against its dedicated repository with Markdown files and related assets.
Go to file
Marcell Mars a77dfe50d9 update about install script 2020-12-02 23:53:42 +01:00
vendor initial commit with go vendor and compiled binary 2020-12-02 17:02:11 +01:00
README.md update about install script 2020-12-02 23:53:42 +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
install_sphook.sh self-destructing install script for gitea 2020-12-02 23:43:28 +01:00
main.go spelling error.. 2020-12-02 17:43:05 +01:00
sphook build after spelling error 2020-12-02 17:46:43 +01:00

README.md

# Sandpoints git hook

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

`install_sphook.sh` bash script will install `sphook` in gitea as a `post-receive` hook. it will delete itself if `sphook` is already in `hooks/post-receive.d/` directory.