when:
  - event: manual
    branch: main
  - event: push
    branch: main
    path: '.woodpecker/babeld.yaml'

steps:
  - name: babeld
    environment:
      PROJECT_NAME: babeld
      PROJECT_PRETTY_NAME: babeld
      PROJECT_VERSION: 1.13.1
      FEED_REVISION: 3
    image: codeberg.org/mark22k/ci:latest
    pull: true
    commands:
      - GIT_BRANCH="babeld-$PROJECT_VERSION"
      - GIT_URL="https://github.com/jech/babeld.git"
      - . ./scripts/environment.sh
      - . ./scripts/install_dashing.sh
      - . ./scripts/download_from_git.sh
      - . ./scripts/prepare_docs_directory.sh
      - cd "$BASE_DIRECTORY/babeld"
      - make babeld.html 
      - cp babeld.html "$DOCS_DIRECTORY"
      - |
          cat << EOF > "$DOCS_DIRECTORY/dashing.json"
          {
              "name": "babeld",
              "package": "babeld",
              "index": "babeld.html",
              "selectors": {
                  "dl dt a": "Option",
                  "h2": "Section",
                  "title": "Guide"
              },
              "allowJS": false
          }
          EOF
      - cd "$FEED_DIRECTORY"
      - . ./scripts/build_dashing.sh
      - . ./scripts/create_docs_tarball.sh
      - . ./scripts/create_feed.sh
      - . ./scripts/publish.sh
    secrets:
      - codeberg_git_username
      - codeberg_git_password
