Skip to content

Commit 4fb5002

Browse files
authored
i18n: fix and complete translation (fr) and use CI to build it (#19)
2 parents 04a27d1 + ea8a2d8 commit 4fb5002

File tree

7 files changed

+338
-73
lines changed

7 files changed

+338
-73
lines changed

.github/workflows/packager.yml

Lines changed: 116 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "📦 Packager"
1+
name: "📦 Packaging & 🚀 Release"
22

33
env:
44
PROJECT_FOLDER: "pyqgis_resource_browser"
@@ -7,10 +7,47 @@ env:
77
on:
88
push:
99
branches: [main]
10+
tags:
11+
- "*"
12+
13+
pull_request:
14+
branches: [main]
15+
paths:
16+
- .github/workflows/packager.yml
1017

1118
jobs:
19+
translation:
20+
name: "💬 i18n compilation"
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Get source code
25+
uses: actions/checkout@v3
26+
27+
- name: Install system requirements
28+
run: |
29+
sudo apt update
30+
sudo apt install qt5-qmake qttools5-dev-tools
31+
32+
- name: Update translations
33+
run: lupdate -noobsolete -verbose ${{ env.PROJECT_FOLDER }}/resources/i18n/plugin_translation.pro
34+
35+
- name: Compile translations
36+
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
37+
38+
- uses: actions/upload-artifact@v3
39+
with:
40+
name: translations-build
41+
path: ${{ env.PROJECT_FOLDER }}/**/*.qm
42+
if-no-files-found: error
43+
44+
# -- NO TAGS ----------------------------------------------------------------------
1245
packaging:
46+
name: "📦 Packaging plugin"
1347
runs-on: ubuntu-latest
48+
needs: [translation]
49+
50+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
1451

1552
steps:
1653
- name: Checkout
@@ -19,25 +56,31 @@ jobs:
1956
- name: Setup Python
2057
uses: actions/setup-python@v4
2158
with:
59+
python-version: ${{ env.PYTHON_VERSION }}
2260
cache: "pip"
2361
cache-dependency-path: "requirements/packaging.txt"
24-
python-version: ${{ env.PYTHON_VERSION }}
25-
26-
- name: Install system requirements
27-
run: |
28-
sudo apt update
29-
sudo apt install qt5-qmake qttools5-dev-tools
3062

3163
- name: Install project requirements
3264
run: |
3365
python -m pip install -U pip setuptools wheel
3466
python -m pip install -U -r requirements/packaging.txt
3567
36-
- name: Update translations
37-
run: pylupdate5 -noobsolete -verbose ${{ env.PROJECT_FOLDER }}/resources/i18n/plugin_translation.pro
68+
- name: Download translations
69+
uses: actions/download-artifact@v3
70+
with:
71+
name: translations-build
72+
path: ${{ env.PROJECT_FOLDER }}
3873

39-
- name: Compile translations
40-
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
74+
- name: List files
75+
run: tree ${{ env.PROJECT_FOLDER }}
76+
77+
- name: Amend gitignore to include compiled translations and add it to tracked files
78+
run: |
79+
# include compiled translations
80+
sed -i "s|^*.qm.*| |" .gitignore
81+
82+
# git add full project
83+
git add ${{ env.PROJECT_FOLDER }}/
4184
4285
- name: Package the latest version
4386
run: qgis-plugin-ci package latest --allow-uncommitted-changes
@@ -47,3 +90,65 @@ jobs:
4790
name: ${{ env.PROJECT_FOLDER }}-latest
4891
path: ${{ env.PROJECT_FOLDER }}.*.zip
4992
if-no-files-found: error
93+
94+
# -- ONLY TAGS ----------------------------------------------------------------------
95+
release:
96+
name: "🚀 Release on tag"
97+
runs-on: ubuntu-latest
98+
needs: [translation]
99+
100+
if: startsWith(github.ref, 'refs/tags/')
101+
102+
steps:
103+
- name: Get tag name as version
104+
id: get_version
105+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
106+
107+
- name: Checkout
108+
uses: actions/checkout@v3
109+
110+
- name: Setup Python
111+
uses: actions/setup-python@v4
112+
with:
113+
python-version: ${{ env.PYTHON_VERSION }}
114+
cache: "pip"
115+
cache-dependency-path: "requirements/packaging.txt"
116+
117+
- name: Install project requirements
118+
run: |
119+
python -m pip install -U pip setuptools wheel
120+
python -m pip install -U -r requirements/packaging.txt
121+
122+
- name: Download translations
123+
uses: actions/download-artifact@v3
124+
with:
125+
name: translations-build
126+
path: ${{ env.PROJECT_FOLDER }}
127+
128+
- name: Amend gitignore to include compiled translations and add it to tracked files
129+
run: |
130+
# include compiled translations
131+
sed -i "s|^*.qm.*| |" .gitignore
132+
133+
# git add full project
134+
git add ${{ env.PROJECT_FOLDER }}/
135+
136+
- name: Get current changelog for ${VERSION}
137+
run: qgis-plugin-ci changelog ${GITHUB_REF/refs\/tags\//} >> release.md
138+
139+
- name: Create GitHub Release
140+
uses: softprops/action-gh-release@v1
141+
with:
142+
fail_on_unmatched_files: true
143+
bodyFile: release.md
144+
generate_release_notes: true
145+
146+
- name: Deploy plugin
147+
run: >-
148+
qgis-plugin-ci
149+
release ${GITHUB_REF/refs\/tags\//}
150+
--allow-uncommitted-changes
151+
--create-plugin-repo
152+
--github-token ${{ secrets.GITHUB_TOKEN }}
153+
--osgeo-username ${{ secrets.OSGEO_USER }}
154+
--osgeo-password ${{ secrets.OSGEO_PASSWORD }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ dmypy.json
132132
# .vscode/
133133
*.qm
134134
.ruff_cache/
135+
pyqgis_resource_browser/gui/*.db

0 commit comments

Comments
 (0)