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

steps:
  - name: openvpn
    environment:
      PROJECT_NAME: openvpn
      PROJECT_PRETTY_NAME: OpenVPN
      PROJECT_VERSION: 2.6.12
      FEED_REVISION: 3
    image: codeberg.org/mark22k/ci:latest
    pull: true
    commands:
      - TARBALL_URL="https://github.com/OpenVPN/openvpn/releases/download/v$PROJECT_VERSION/openvpn-$PROJECT_VERSION.tar.gz"
      - . ./scripts/environment.sh
      - . ./scripts/install_dashing.sh
      - . ./scripts/download_tarball.sh
      - . ./scripts/prepare_docs_directory.sh
      - cp "$BASE_DIRECTORY/openvpn-$PROJECT_VERSION/doc/openvpn.8.html" ../docs
      - cp "$BASE_DIRECTORY/openvpn-$PROJECT_VERSION/doc/openvpn-examples.5.html" ../docs
      - |
          cat << EOF > "$DOCS_DIRECTORY/dashing.json"
          {
              "name": "OpenVPN",
              "package": "OpenVPN",
              "index": "openvpn.8.html",
              "selectors": {
                  "title": "Package",
                  "kbd span.option": "Option"
              },
              "allowJS": false
          }
          EOF          
      - . ./scripts/build_dashing.sh
      - . ./scripts/create_docs_tarball.sh
      - . ./scripts/create_feed.sh
      - . ./scripts/publish.sh
    secrets:
      - codeberg_git_username
      - codeberg_git_password
