Commit d08644ab authored by Jérôme Charaoui's avatar Jérôme Charaoui 🕯️
Browse files

Add a partial-build job

Remove older press pages to speed up builds from branches.
parent 25e07a56
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
variables:
  SITE_URL: www.torproject.org
  TRANSLATION_BRANCH: "tpo-web"
  SITE_URL: www.torproject.org
  STAGING_URL: www-staging.torproject.org
@@ -8,3 +9,20 @@ include:
    file: lektor.yml
  - project: tpo/tpa/ci-templates
    file: static-shim-deploy.yml

# for review apps (branches), move some press content out of the way to decrease
# the build time by a factor of at least 4x -- keep only the last 1 year of
# press articles
partial-build:
  extends: .partial-build
  before_script:
    - !reference [.apt-init]
    - export CUTOFF=$(date -d "$(date +%Y-%m-%d) -365 day" +%Y-%m-%d)
    - awk '{if($1=="pub_date:" && $2 < ENVIRON["CUTOFF"])print FILENAME}' content/press/*/contents.lr | while read -d $'\n' f; do rm "$f"; done

# limit regular build job to default branch, for staging/prod
build:
  rules:
    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
      when: never
    - if: '$CI_COMMIT_BRANCH'