aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/deploy-docs.sh
blob: 7bdae3a6372804c691f426ba7190d5a1644cdb35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
set -eou pipefail

source "$(dirname "${BASH_SOURCE[0]}")/lib/log.sh"

readonly SITE="bolt.eugenetriguba.com"

usage() {
  echo "Usage: $0"
  echo ""
  echo "Build and deploy documentation to SourceHut Pages"
  echo ""
  echo "Examples:"
  echo "  $0    # Build and deploy docs to $SITE"
}

main() {
  if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
    usage
    exit 0
  fi

  log_header "Deploying Documentation"
  build_docs
  package_site
  deploy_to_pages
}

build_docs() {
  log_step "Building documentation with MkDocs"
  mkdocs build
  log_success "Documentation built successfully"
}

package_site() {
  log_step "Creating tarball"
  tar -C site -czf site.tar.gz .
  log_success "Site packaged as site.tar.gz"
}

deploy_to_pages() {
  log_step "Deploying to SourceHut Pages: $SITE"
  hut pages publish -d "$SITE" site.tar.gz
  log_success "Documentation deployed to https://$SITE"
}

main "$@"