Skip to content

New translations were found #1557

New translations were found

New translations were found #1557

# This workflow takes care of sending translations to POEditor or Github Pages.
name: Translate source
on:
push:
branches:
- develop
jobs:
SendToPoeditor:
name: Send translatable strings to POEditor
runs-on: ubuntu-latest
# Avoid systems crossing each other by not looking for string changes
# in commits coming from POEditor or from the job itself.
# Commits from POEditor are in the format: "Update [file] (POEditor.com)"
# Commits from the this job says: "New translations were found"
if: ${{ !contains(github.event.head_commit.message, 'POEditor.com') && !contains(github.event.head_commit.message, 'New translations were found') }}
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
env:
LANGUAGE: da
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.AUTOCOMMIT_GITHUB_TOKEN }}
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Scan user interface translations
run: task translations:scan
- name: Export translatable configuration strings
run: task translations:conf:export
- name: Combine danish po files
run: task translations:conf:merge
env:
FILE_A: web/profiles/dpl_cms/translations/da.po
FILE_B: web/profiles/dpl_cms/translations/da.config.po
- name: Commit all combined translations
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: "./web/profiles/dpl_cms/translations/*.combined.po"
commit_message: New translations were found
- name: Make Poeditor look for changes in translation strings
uses: distributhor/workflow-webhook@v3
env:
webhook_url: ${{ secrets.POEDITOR_WEBHOOK_URL }}
# POEditor webhooks to not use secrets but the action requires a value.
webhook_secret: "xxxx"
# Publish translations to GitHub Pages to support consumption by Drupal.
# The localization system requires translation files to be served with a
# proper Last-Modified header. This is not possible raw GitHub files.
PublishToGithubPages:
name: Publish translations to Github Pages
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, 'POEditor.com') }}
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository which also contain GitHub
# Pages.
contents: write
env:
LANGUAGE: da
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install go-task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup site
run: task ci:reset
- name: Separate danish translations into po file
run: task translations:separate
- name: Separate danish configuration translations into po file
run: task translations:separate:config
- name: Publish translations to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./web/profiles/dpl_cms/translations
destination_dir: translations