diff --git a/.github/actions/setup-mdbook/action.yaml b/.github/actions/setup-mdbook/action.yaml new file mode 100644 index 0000000..23e0665 --- /dev/null +++ b/.github/actions/setup-mdbook/action.yaml @@ -0,0 +1,16 @@ +name: "Setup mdbook" +inputs: + version: + description: "mdbook version" + +runs: + using: composite + steps: + - name: Setup mdbook + shell: bash + env: + url: https://github.com/rust-lang/mdbook/releases/download/${{ inputs.version }}/mdbook-${{ inputs.version }}-x86_64-unknown-linux-gnu.tar.gz + run: | + mkdir mdbook + curl -sSL "$url" | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..974d953 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,39 @@ +name: docs +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write # To push a branch + pages: write # To push to a GitHub Pages site + id-token: write # To update the deployment status + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + lfs: "true" + + - uses: ./.github/actions/setup-mdbook + with: + version: v0.4.42 # renovate: datasource=github-releases depName=rust-lang/mdbook + + - name: Build Book + working-directory: docs + run: mdbook build + + - name: Setup Pages + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 + with: + # Upload entire repository + path: "docs/book" + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 diff --git a/README.md b/README.md index c57257f..4383aa0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # `hcloud-upload-image` -Quickly upload any raw disk images into your [Hetzner Cloud](https://hetzner.com/cloud) projects! +

+ Quickly upload any raw disk images into your Hetzner Cloud projects! +

+ +

+ Badge: Documentation + Badge: Stable Release + Badge: License MIT +

+ ## About @@ -63,7 +72,7 @@ hcloud-upload-image upload \ --compression bz2 ``` -To learn more, you can use the embedded help output or check out the [CLI help pages in this repository](docs/cli/hcloud-upload-image.md).: +To learn more, you can use the embedded help output or check out the [CLI help pages in this repository](docs/reference/cli/hcloud-upload-image.md).: ```shell hcloud-upload-image --help diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..b7a1b8c --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +book +https: diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md new file mode 100644 index 0000000..8f188b4 --- /dev/null +++ b/docs/SUMMARY.md @@ -0,0 +1,22 @@ +# Summary + +[Introduction](introduction.md) + +# Guides + +- [Uploading Images](guides/README.md) + - [Fedora CoreOS ↗](https://docs.fedoraproject.org/en-US/fedora-coreos/provisioning-hetzner/#_creating_a_snapshot) + - [Flatcar Container Linux ↗](https://www.flatcar.org/docs/latest/installing/cloud/hetzner/#building-the-snapshots-1) + - [Talos Linux ↗](https://www.talos.dev/v1.10/talos-guides/install/cloud-platforms/hetzner/#hcloud-upload-image) + +# Reference + +- [CLI](reference/cli/hcloud-upload-image.md) + - [`upload`](reference/cli/hcloud-upload-image_upload.md) + - [`cleanup`](reference/cli/hcloud-upload-image_cleanup.md) +- [Go Library](reference/go-library.md) + +--- + +[Changelog CLI](changelog.md) +[Changelog Go Library](changelog-hcloudimages.md) diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..db7ede2 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,8 @@ +[book] +language = "en" +multilingual = false +src = "." +title = "hcloud-upload-image" + +[output.html] +git-repository-url = "https://github.com/apricote/hcloud-upload-image" diff --git a/docs/changelog-hcloudimages.md b/docs/changelog-hcloudimages.md new file mode 100644 index 0000000..d492f13 --- /dev/null +++ b/docs/changelog-hcloudimages.md @@ -0,0 +1,3 @@ +# Changelog Library + +{{#include ../hcloudimages/CHANGELOG.md:2: }} diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..76ff939 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,3 @@ +# Changelog CLI + +{{#include ../CHANGELOG.md:2: }} diff --git a/docs/guides/README.md b/docs/guides/README.md new file mode 100644 index 0000000..9fc9435 --- /dev/null +++ b/docs/guides/README.md @@ -0,0 +1,7 @@ +# Uploading Images + +Check out these docs from other projects to learn how to use `hcloud-upload-image`: + +- [Fedora CoreOS ↗](https://docs.fedoraproject.org/en-US/fedora-coreos/provisioning-hetzner/#_creating_a_snapshot) +- [Flatcar Container Linux ↗](https://www.flatcar.org/docs/latest/installing/cloud/hetzner/#building-the-snapshots-1) +- [Talos Linux ↗](https://www.talos.dev/v1.10/talos-guides/install/cloud-platforms/hetzner/#hcloud-upload-image) diff --git a/docs/introduction.md b/docs/introduction.md new file mode 100644 index 0000000..71809aa --- /dev/null +++ b/docs/introduction.md @@ -0,0 +1,3 @@ +# Introduction + +{{#include ../README.md:2:}} \ No newline at end of file diff --git a/docs/cli/hcloud-upload-image.md b/docs/reference/cli/hcloud-upload-image.md similarity index 100% rename from docs/cli/hcloud-upload-image.md rename to docs/reference/cli/hcloud-upload-image.md diff --git a/docs/cli/hcloud-upload-image_cleanup.md b/docs/reference/cli/hcloud-upload-image_cleanup.md similarity index 100% rename from docs/cli/hcloud-upload-image_cleanup.md rename to docs/reference/cli/hcloud-upload-image_cleanup.md diff --git a/docs/cli/hcloud-upload-image_upload.md b/docs/reference/cli/hcloud-upload-image_upload.md similarity index 100% rename from docs/cli/hcloud-upload-image_upload.md rename to docs/reference/cli/hcloud-upload-image_upload.md diff --git a/docs/reference/go-library.md b/docs/reference/go-library.md new file mode 100644 index 0000000..46edc04 --- /dev/null +++ b/docs/reference/go-library.md @@ -0,0 +1,3 @@ +# Go Library + +You can find the documentation at [pkg.go.dev/github.com/apricote/hcloud-upload-image/hcloudimages ↗](https://pkg.go.dev/github.com/apricote/hcloud-upload-image/hcloudimages). diff --git a/scripts/cli-help-pages.go b/scripts/cli-help-pages.go index 778a19b..527b04a 100644 --- a/scripts/cli-help-pages.go +++ b/scripts/cli-help-pages.go @@ -11,7 +11,7 @@ import ( func run() error { // Define the directory where the docs will be generated - dir := "docs/cli" + dir := "docs/reference/cli" // Ensure the directory exists if err := os.MkdirAll(dir, 0755); err != nil {