diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..cad7e5e --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,56 @@ +name: Docs + +on: + push: + branches: + - main + paths: + - ".github/workflows/docs.yaml" + - "hugo.toml" + - "content/**" + - "layouts/**" + - "static/**" + - "README.md" + - "CONTRIBUTING.md" + - "docs/RELEASE.md" + pull_request: + branches: + - main + paths: + - ".github/workflows/docs.yaml" + - "hugo.toml" + - "content/**" + - "layouts/**" + - "static/**" + - "README.md" + - "CONTRIBUTING.md" + - "docs/RELEASE.md" + workflow_dispatch: + +permissions: + contents: write + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v6.0.2 + with: + fetch-depth: 0 + + - name: Set up Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.148.2' + + - name: Build documentation site + run: hugo build --gc --minify + + - name: Deploy documentation site + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: public + clean: true diff --git a/.gitignore b/.gitignore index a1f19c4..b1e9e73 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ /.idea/ /vendor/ /dist/ +/public/ +/resources/ +/.hugo_build.lock diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..6f340a0 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,3 @@ +--- +title: "KVS" +--- diff --git a/content/docs/_index.md b/content/docs/_index.md new file mode 100644 index 0000000..b40df67 --- /dev/null +++ b/content/docs/_index.md @@ -0,0 +1,3 @@ +--- +title: "Documentation" +--- diff --git a/content/docs/cli.md b/content/docs/cli.md new file mode 100644 index 0000000..16dd4c2 --- /dev/null +++ b/content/docs/cli.md @@ -0,0 +1,34 @@ +--- +title: "CLI Usage" +weight: 2 +--- + +The `kvs` binary exposes a small Cobra-based CLI for interacting with the key-value store. + +## Basic Commands + +```sh +$ kvs --help +$ kvs -v +$ kvs version +``` + +## Configuration + +Use `--config` to load a specific Viper-compatible configuration file: + +```sh +$ kvs --config config.yaml version +``` + +## Available Flags + +| Flag | Description | +|------|-------------| +| `--help`, `-h` | Show help for any command | +| `-v` | Show version information | +| `--config` | Path to config file | + +## Further Reading + +For Go API usage, see the [Overview](../overview/) documentation or the [Go package reference](https://pkg.go.dev/github.com/skyoo2003/kvs). diff --git a/content/docs/contributing.md b/content/docs/contributing.md new file mode 100644 index 0000000..0aef4a0 --- /dev/null +++ b/content/docs/contributing.md @@ -0,0 +1,24 @@ +--- +title: "Contributing" +weight: 3 +--- + +Contribution guidance is still being documented. + +## Current Status + +The repository currently keeps its contribution guide in `CONTRIBUTING.md`, which is marked as `_TBD_`. + +## Repository Links + +- [Repository on GitHub](https://github.com/skyoo2003/kvs) +- [Project README](https://github.com/skyoo2003/kvs/blob/main/README.md) +- [Current contributing file](https://github.com/skyoo2003/kvs/blob/main/CONTRIBUTING.md) + +## Contributing Today + +Until the dedicated guide is expanded, use the existing repository files and open a pull request with the proposed change. + +## Note + +This page summarizes the current contribution information available in the repository. diff --git a/content/docs/overview.md b/content/docs/overview.md new file mode 100644 index 0000000..06b988f --- /dev/null +++ b/content/docs/overview.md @@ -0,0 +1,49 @@ +--- +title: "Overview" +weight: 1 +--- + +KVS is a simple key-value store written in Go. It provides an in-memory store that can be used as a library within Go programs or via its command-line interface. + +## Features + +- In-memory key-value storage +- Clean Go API for programmatic use +- Cobra-based CLI for command-line operations +- Viper configuration support + +## Installation + +Clone and install the CLI: + +```sh +$ git clone https://github.com/skyoo2003/kvs.git +$ cd kvs +$ go install ./cmd/kvs +``` + +## Library Usage + +Import `github.com/skyoo2003/kvs` to use KVS as a library: + +```go +package main + +import ( + "fmt" + + "github.com/skyoo2003/kvs" +) + +func main() { + store := kvs.NewStore() + _ = store.Put("language", "go") + + value, _ := store.Get("language") + fmt.Println(value) +} +``` + +## License + +MIT License. See [LICENSE](https://github.com/skyoo2003/kvs/blob/main/LICENSE) for details. diff --git a/content/docs/release.md b/content/docs/release.md new file mode 100644 index 0000000..c382210 --- /dev/null +++ b/content/docs/release.md @@ -0,0 +1,38 @@ +--- +title: "Release Process" +weight: 4 +--- + +The repository tracks release notes in `docs/RELEASE.md`, automates tagged releases with GitHub Actions, and publishes the documentation site through `gh-pages`. + +## Commands + +```sh +$ changie new +$ changie batch {version} +$ changie merge +``` + +## Current Workflow + +The release workflow lives in `.github/workflows/release.yaml` and runs when a tag matching `v*` is pushed. + +## Project Release + +For an application release, prepare the changelog with `changie`, push a version tag such as `v1.2.3`, and let the `Release` workflow publish the artifacts defined in `.goreleaser.yml`. + +After the tag is pushed, verify that the `Release` workflow succeeds and that the GitHub release contains the expected binaries and archives. + +## Documentation Site Release + +The documentation workflow lives in `.github/workflows/docs.yaml`. + +When a docs-related change is pushed to `main`, GitHub Actions builds the Hugo site and deploys the generated `public/` directory to the `gh-pages` branch. + +For this to publish correctly, repository settings must point GitHub Pages at the `gh-pages` branch root. + +After a merge, verify that the `Docs` workflow succeeds and that the site is available at `https://skyoo2003.github.io/kvs/`. + +## Note + +This page summarizes the current release information and workflow already present in the repository. diff --git a/docs/RELEASE.md b/docs/RELEASE.md index e6efeaa..6d96e04 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -1,6 +1,9 @@ # Release -_TBD_ +This repository has two release paths: + +- tagged application releases through `.github/workflows/release.yaml` +- static documentation site releases through `.github/workflows/docs.yaml` ## Commands @@ -9,3 +12,56 @@ $ changie new $ changie batch {version} $ changie merge ``` + +## Project Release + +Project releases are published from `.github/workflows/release.yaml` when a tag matching `v*` is pushed. + +### Preparation + +1. Create changelog entries with `changie new` +2. Batch the release notes with `changie batch {version}` +3. Merge the changelog with `changie merge` +4. Commit the release notes and create the release tag + +### Publish Flow + +1. Push a tag such as `v1.2.3` +2. GitHub Actions runs `.github/workflows/release.yaml` +3. GoReleaser builds the `kvs` binaries and archives defined in `.goreleaser.yml` +4. The workflow publishes the GitHub release artifacts and related package outputs + +### Verification + +After pushing the tag, confirm that the `Release` workflow succeeds and that the expected release artifacts are attached to the GitHub release. + +## Documentation Site Release + +The static documentation site is built with Hugo and published to the `gh-pages` branch. + +### Trigger + +The docs workflow runs on pushes to `main` when one of these paths changes: + +- `hugo.toml` +- `content/**` +- `layouts/**` +- `static/**` +- `README.md` +- `CONTRIBUTING.md` +- `docs/RELEASE.md` +- `.github/workflows/docs.yaml` + +### Publish Flow + +1. GitHub Actions runs `.github/workflows/docs.yaml` +2. Hugo builds the site into `public/` +3. `JamesIves/github-pages-deploy-action` publishes `public/` to the `gh-pages` branch + +### Repository Setting + +GitHub Pages must be configured to serve from the `gh-pages` branch root. + +### Verification + +After merging a docs change to `main`, confirm that the `Docs` workflow succeeds and that the site is available at `https://skyoo2003.github.io/kvs/` diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..778a8a3 --- /dev/null +++ b/hugo.toml @@ -0,0 +1,16 @@ +baseURL = 'https://skyoo2003.github.io/kvs/' +languageCode = 'en-us' +title = 'KVS Documentation' + +[menu] + [[menu.main]] + name = "Home" + url = "/" + weight = 1 + [[menu.main]] + name = "Documentation" + url = "/docs/" + weight = 2 + +[markup.goldmark.renderer] + unsafe = true diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..9f0b449 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,25 @@ + + +
+ + +A simple key-value store for Go
+KVS is a lightweight in-memory key-value store with a Cobra-based CLI. Import it into your Go programs or use the command-line tool directly.
+