Skip to content

Expand variables for `pages.publish` job property

@ksills-dev noted that the publish property in the pages job configuration does not work with variable expansion:

pages:
  stage: deploy
  image: python:latest
  script:
    - mkdocs build --site-dir $BUILD_DIR
  artifacts:
    - $BUILD_DIR
  publish: $BUILD_DIR
  pages:
    path_prefix $[[ inputs.pages_prefix | expand_vars ]]

To solve this, I think we just need to expand variables for that property, as we do with path_prefix in the pages method in ee/app/models/ee/ci/build.rb:

      def pages
        return {} unless pages_generator?

        pages_config.tap do |pages_options|
          pages_options[:path_prefix] = ExpandVariables.expand(pages_options[:path_prefix].to_s, -> {
              variables.sort_and_expand_all
            })
        end
      end