# Build and publish the docs

pages:
  stage: deploy
  image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
  tags:
    - flatpak
  script:
    - flatpak install --user --noninteractive org.freedesktop.Sdk.Extension.rust-nightly//23.08
    # We want to use rust-nightly to build the app, but mold is in rust-stable
    - sed -i 's|"org.freedesktop.Sdk.Extension.rust-stable"|"org.freedesktop.Sdk.Extension.rust-stable","org.freedesktop.Sdk.Extension.rust-nightly"|g' ${MANIFEST_PATH}
    - sed -i 's|:/usr/lib/sdk/rust-stable/bin|:/usr/lib/sdk/rust-nightly/bin|g' ${MANIFEST_PATH}
    - flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
    - echo "ninja src/doc" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
    - mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/src/doc public
    - chmod -R a=rwx public
  dependencies: []
  artifacts:
    paths:
      - 'public'
