-
-
Notifications
You must be signed in to change notification settings - Fork 24
98 lines (85 loc) · 3.09 KB
/
translation.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
89
90
91
92
93
94
95
96
97
98
name: translate & package
env:
PLUGIN_VERSION: $(python qaequilibrae/get_version.py)
PROJECT_FOLDER: "qaequilibrae"
CURRENT_BRANCH: $(git branch --show-current)
VALIDATE_FILE: "is_file"
on:
push:
branches:
- develop
pull_request:
jobs:
translation:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install packages
run: |
sudo apt-get update
sudo apt install qttools5-dev-tools
python -m pip install --upgrade pip
python -m pip install -r ci/packaging.txt
- name: Create translatable files
if: ${{(github.ref == 'refs/heads/develop') && (github.event_name == 'push')}}
run: |
python qaequilibrae/i18n/create_pro_file.py
pylupdate5 qaequilibrae/i18n/qaequilibrae.pro
rm qaequilibrae/i18n/qaequilibrae.pro
- name: Check if there are modifications in the translatable files
id: check-modifications
if: ${{(github.ref == 'refs/heads/develop') && (github.event_name == 'push')}}
run: |
git fetch --no-tags --depth=1 origin ${{ env.CURRENT_BRANCH }}
files_created=$(git ls-files --others --exclude-standard)
files_changed=$(git diff --name-only)
if echo "${files_changed}" | grep --quiet "qaequilibrae/i18n/qaequilibrae.ts"; then
echo ".ts file was modified!"
echo "is_file=$is_file" >> $GITHUB_OUTPUT
elif echo "${files_created}" | grep --quiet "qaequilibrae/i18n/qaequilibrae.ts"; then
echo ".ts file was created!"
echo "is_file=$is_file" >> $GITHUB_OUTPUT
else
echo ".ts file wasn't modified."
fi
- name: Create PR
if: steps.check-modifications.outputs.is_file == ${{ env.VALIDATE_FILE }}
uses: peter-evans/create-pull-request@v6
with:
commit-message: update .ts file
title: Update translatable file
body: |
- Updates the translatable files for Transifex integration
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-ts
- name: Compile translations if they exist
run: |
cd qaequilibrae/i18n
translatable_files=$(ls)
cd ../..
if echo "$translatable_files" | grep "qaequilibrae_.*\.ts"; then
echo "Translatable files found"
lrelease ${{ env.PROJECT_FOLDER }}/i18n/qaequilibrae_*.ts
sed -i "s|^*.qm.*| |" .gitignore
git add ${{ env.PROJECT_FOLDER }}/
else
echo "No translatable files found"
fi
- name: Build the package
run: qgis-plugin-ci package ${{ env.PLUGIN_VERSION }} -c
- name: Download artifact
uses: actions/upload-artifact@v4
with:
name: qaequilibrae
path: /home/runner/work/qaequilibrae/qaequilibrae/*.zip
if-no-files-found: warn