genom 1.1.1

Fast reverse geocoding with additional location data
Documentation
name: Deploy Documentation

on:
  push:
    branches: [master]
  workflow_dispatch:
  workflow_call:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Pages
        uses: actions/configure-pages@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install minification tools
        run: npm install -g html-minifier-terser csso-cli

      - name: Build documentation site
        run: |
          mkdir -p docs
          cp -r docs-src/* docs/
          
          VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
          VERSION_CUT=$(echo "$VERSION" | sed 's/\.[0-9]*$//')
          find docs -name "*.html" -exec sed -i "s|VERSION_CUT|${VERSION_CUT}|g" {} \;
          find docs -name "*.html" -exec sed -i "s|VERSION|v${VERSION}|g" {} \;

      - name: Minify assets
        run: |
          find docs -name "*.css" -type f | while read file; do
            csso "$file" -o "$file"
          done
          
          find docs -name "*.html" -type f | while read file; do
            html-minifier-terser \
              --collapse-whitespace \
              --remove-comments \
              --remove-redundant-attributes \
              --minify-css true \
              --minify-js true \
              -o "$file" "$file"
          done

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: docs

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4