-
Notifications
You must be signed in to change notification settings - Fork 14
88 lines (86 loc) · 3.43 KB
/
translate-source.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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