l10n.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ---
  2. name: Translation
  3. # yamllint disable-line rule:truthy
  4. on:
  5. workflow_dispatch:
  6. workflow_run:
  7. workflows:
  8. - Integration
  9. types:
  10. - completed
  11. branches:
  12. - master
  13. schedule:
  14. - cron: "05 07 * * 5"
  15. concurrency:
  16. group: ${{ github.workflow }}-${{ github.ref_name }}
  17. cancel-in-progress: false
  18. permissions:
  19. contents: read
  20. env:
  21. PYTHON_VERSION: "3.13"
  22. jobs:
  23. update:
  24. if: github.repository_owner == 'searxng' && github.event.workflow_run.conclusion == 'success'
  25. name: Update
  26. runs-on: ubuntu-24.04-arm
  27. permissions:
  28. # For "make V=1 weblate.push.translations"
  29. contents: write
  30. steps:
  31. - name: Setup Python
  32. uses: actions/setup-python@v5
  33. with:
  34. python-version: "${{ env.PYTHON_VERSION }}"
  35. - name: Checkout
  36. uses: actions/checkout@v4
  37. with:
  38. token: "${{ secrets.WEBLATE_GITHUB_TOKEN }}"
  39. fetch-depth: "0"
  40. - name: Setup cache Python
  41. uses: actions/cache@v4
  42. with:
  43. key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}"
  44. restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-"
  45. path: "./local/"
  46. - name: Setup venv
  47. run: make V=1 install
  48. - name: Setup Weblate
  49. run: |
  50. mkdir -p ~/.config
  51. echo "${{ secrets.WEBLATE_CONFIG }}" > ~/.config/weblate
  52. - name: Setup Git
  53. run: |
  54. git config --global user.email "searxng-bot@users.noreply.github.com"
  55. git config --global user.name "searxng-bot"
  56. - name: Update translations
  57. run: make V=1 weblate.push.translations
  58. pr:
  59. if: |
  60. github.repository_owner == 'searxng'
  61. && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
  62. name: Pull Request
  63. runs-on: ubuntu-24.04-arm
  64. permissions:
  65. # For "make V=1 weblate.translations.commit"
  66. contents: write
  67. # For action "peter-evans/create-pull-request"
  68. pull-requests: write
  69. steps:
  70. - name: Setup Python
  71. uses: actions/setup-python@v5
  72. with:
  73. python-version: "${{ env.PYTHON_VERSION }}"
  74. - name: Checkout
  75. uses: actions/checkout@v4
  76. with:
  77. token: "${{ secrets.WEBLATE_GITHUB_TOKEN }}"
  78. fetch-depth: "0"
  79. - name: Setup cache Python
  80. uses: actions/cache@v4
  81. with:
  82. key: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-${{ hashFiles('./requirements*.txt') }}"
  83. restore-keys: "python-${{ env.PYTHON_VERSION }}-${{ runner.arch }}-"
  84. path: "./local/"
  85. - name: Setup venv
  86. run: make V=1 install
  87. - name: Setup Weblate
  88. run: |
  89. mkdir -p ~/.config
  90. echo "${{ secrets.WEBLATE_CONFIG }}" > ~/.config/weblate
  91. - name: Setup Git
  92. run: |
  93. git config --global user.email "searxng-bot@users.noreply.github.com"
  94. git config --global user.name "searxng-bot"
  95. - name: Merge and push translation updates
  96. run: make V=1 weblate.translations.commit
  97. - name: Create PR
  98. id: cpr
  99. uses: peter-evans/create-pull-request@v7
  100. with:
  101. author: "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>"
  102. committer: "searxng-bot <searxng-bot@users.noreply.github.com>"
  103. title: "[l10n] update translations from Weblate"
  104. commit-message: "[l10n] update translations from Weblate"
  105. branch: "translations_update"
  106. delete-branch: "true"
  107. draft: "false"
  108. signoff: "false"
  109. labels: |
  110. translation
  111. - name: Display information
  112. run: |
  113. echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
  114. echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"