Commit 6e8cd693 authored by Adrian DC's avatar Adrian DC
Browse files

ci(gitlab-ci): append Git version to PDF output file name

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent 9235ece9
Loading
Loading
Loading
Loading
+4 −2
Changes for .gitlab-ci.yml: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -852,13 +852,15 @@ pages:
  variables:
    CI_LOCAL_NETWORK: 'host'
    MKDOCS_EXPORTER_PDF_ENABLED: 'true'
    MKDOCS_EXPORTER_PDF_OUTPUT: 'documentation.pdf'
    MKDOCS_EXPORTER_PDF_OUTPUT: 'documentation'
  script:
    # Fetch all tags
    - |
      if [ -z "${CI_LOCAL:-}" ]; then
        git fetch --tags --unshallow || true
      fi
    # Set PDF output version
    - export MKDOCS_EXPORTER_PDF_OUTPUT="${MKDOCS_EXPORTER_PDF_OUTPUT%.pdf}-$(git describe --abbrev=7 --always --tags).pdf"
    # Run locally without PDF
    - |
      if [ ! -z "${CI_LOCAL:-}" ] && [ ! "${CI_JOB_NAME:-}" = 'pdf' ]; then
@@ -918,7 +920,7 @@ pdf:
  artifacts:
    expire_in: 1 hour
    paths:
      - public/$MKDOCS_EXPORTER_PDF_OUTPUT
      - public/$MKDOCS_EXPORTER_PDF_OUTPUT*.pdf
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH
+1 −1
Changes for docs/.pages.in: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -6,4 +6,4 @@ nav:
      - ‣ Changelog: about/changelog/
      - ‣ License: about/license/
      - ‣ Quality: about/quality/
      - ‣ Export as PDF: !MKDOCS_EXPORTER_PDF_OUTPUT!
      - ‣ Export as PDF: %MKDOCS_EXPORTER_PDF_OUTPUT%
+1 −1
Changes for docs/prepare.sh: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ projectYear=$(date '+%Y')

# Prepare pages
cp -f "${docs_path}/.pages.in" "${docs_path}/.pages"
sed -i "s/!MKDOCS_EXPORTER_PDF_OUTPUT!/${MKDOCS_EXPORTER_PDF_OUTPUT:?}/g" "${docs_path}/.pages"
sed -i "s/%MKDOCS_EXPORTER_PDF_OUTPUT%/${MKDOCS_EXPORTER_PDF_OUTPUT:?}/g" "${docs_path}/.pages"

# Export usage
cp -f "${root_path}/README.md" "${docs_path}/index.md"