pre.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Write CI cache once for faster runs
  2. 'write cache: ruby':
  3. stage: pre
  4. cache: !reference [.cache, read_write_ruby]
  5. before_script:
  6. - !reference [.scripts, source_rvm]
  7. script:
  8. - !reference [.scripts, bundle_install]
  9. after_script: []
  10. 'write cache: nodejs':
  11. stage: pre
  12. cache: !reference [.cache, read_write_nodejs]
  13. before_script: []
  14. script:
  15. - !reference [.scripts, pnpm_install_all]
  16. after_script: []
  17. 'push to github':
  18. stage: pre
  19. cache: []
  20. rules:
  21. - if: $CI_COMMIT_REF_NAME =~ /^(private|cherry-pick-|renovate|dependabot)/
  22. when: never
  23. - when: always
  24. before_script:
  25. - test -d $HOME/.ssh || mkdir $HOME/.ssh
  26. - ssh-keyscan github.com >> $HOME/.ssh/known_hosts
  27. - eval $(ssh-agent -s)
  28. - echo "$PUSH_TO_GITHUB_SSH_PRIVATE_KEY" | ssh-add -
  29. - ssh-add -l
  30. script:
  31. - git fetch --unshallow
  32. - script/build/sync_repo.sh git@github.com:zammad/zammad.git
  33. after_script: []
  34. 'publish source archives':
  35. stage: pre
  36. tags:
  37. - push-to-ftp
  38. cache: []
  39. rules:
  40. - if: $CI_COMMIT_TAG
  41. when: always
  42. - if: $CI_COMMIT_BRANCH == "stable"
  43. when: always
  44. - when: never
  45. before_script:
  46. - test -d $HOME/.ssh || mkdir $HOME/.ssh
  47. - ssh-keyscan ftp.zammad.com >> $HOME/.ssh/known_hosts
  48. - eval $(ssh-agent -s)
  49. - echo "$FTP_ZAMMAD_COM_SSH_PRIVATE_KEY" | ssh-add -
  50. - ssh-add -l
  51. script:
  52. - script/build/deploy_archives.sh
  53. after_script: []
  54. # This job will create commits in pipelines pushed from Weblate.
  55. # It re-generates the catalog, and any additional files such as view templates and chat assets.
  56. 'push translations update commit':
  57. stage: pre
  58. needs: ['write cache: ruby', 'write cache: nodejs']
  59. rules:
  60. - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE =~ /Translations update from translations[.]zammad[.]org/
  61. when: always
  62. - when: never
  63. cache:
  64. - !reference [.cache, read_only_ruby]
  65. - !reference [.cache, read_only_nodejs]
  66. services:
  67. - !reference [.services, postgresql]
  68. before_script:
  69. - !reference [.scripts, source_rvm]
  70. - !reference [.scripts, bundle_install]
  71. - !reference [.scripts, configure_environment]
  72. - !reference [.scripts, zammad_db_init]
  73. - !reference [.scripts, pnpm_install_chat]
  74. variables:
  75. ZAMMAD_SAFE_MODE: 1
  76. script:
  77. - bundle exec rails generate zammad:translation_catalog --full
  78. - (cd public/assets/chat && pnpm exec gulp build)
  79. - git status
  80. - git config user.email "noreply@weblate.org"
  81. - git config user.name "Weblate"
  82. # TODO drop usage of dedicated access token when CI_JOB_TOKEN support for commit pushing was added to weblate
  83. # https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html#git-push-to-your-project-repository
  84. - git remote add gitlab_origin https://oauth2:${WEBLATE_ACCESS_TOKEN}@${CI_SERVER_FQDN}/${CI_PROJECT_PATH}.git
  85. - git add .
  86. - git status --porcelain | grep "^[MA]" || exit 0 # check if files were added/changed
  87. - 'git commit -m "Maintenance: Update translated files and catalog"'
  88. - git show --stat
  89. - git push gitlab_origin HEAD:$CI_COMMIT_REF_NAME