1+ name : " 📦 Package & 🚀 Release"
2+
3+ env :
4+ PROJECT_FOLDER : plugin_map2loop
5+ PYTHON_VERSION : 3.9
6+
7+ on :
8+ push :
9+ branches :
10+ - main
11+ paths :
12+ - .github/workflows/package_and_release.yml
13+ - ' docs/**/*'
14+ - " plugin_map2loop/**/*.py"
15+ - " plugin_map2loop/metadata.txt"
16+ tags :
17+ - " *"
18+
19+ # Allow one concurrent deployment per branch/pr
20+ concurrency :
21+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+ cancel-in-progress : true
23+
24+ jobs :
25+ translation :
26+ name : " 💬 i18n compilation"
27+ runs-on : ubuntu-latest
28+
29+ steps :
30+ - name : Get source code
31+ uses : actions/checkout@v4
32+
33+ - name : Setup Python
34+ uses : actions/setup-python@v5
35+ with :
36+ python-version : ${{ env.PYTHON_VERSION }}
37+
38+ - name : Install translation requirements
39+ run : |
40+ sudo apt update
41+ sudo apt install qt5-qmake qttools5-dev-tools
42+ python3 -m pip install -U pyqt5-tools
43+
44+ - name : Update translations
45+ run : |
46+ python3 scripts/generate_translation_profile.py
47+ pylupdate5 -noobsolete -verbose ${{ env.PROJECT_FOLDER }}/resources/i18n/plugin_translation.pro
48+
49+ - name : Compile translations
50+ run : lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
51+
52+ - uses : actions/upload-artifact@v4
53+ with :
54+ name : translations-build
55+ path : ${{ env.PROJECT_FOLDER }}/**/*.qm
56+ if-no-files-found : error
57+
58+ # -- NO TAGS ----------------------------------------------------------------------
59+ packaging :
60+ name : " 📦 Packaging plugin"
61+ runs-on : ubuntu-latest
62+ needs :
63+ - translation
64+
65+ if : ${{ !startsWith(github.ref, 'refs/tags/') }}
66+
67+ steps :
68+ - name : Checkout
69+ uses : actions/checkout@v4
70+
71+ - name : Setup Python
72+ uses : actions/setup-python@v5
73+ with :
74+ cache : " pip"
75+ cache-dependency-path : " requirements/packaging.txt"
76+ python-version : ${{ env.PYTHON_VERSION }}
77+
78+ - name : Install dependencies
79+ run : |
80+ python -m pip install -U pip setuptools wheel
81+ python -m pip install -U -r requirements/packaging.txt
82+
83+ - name : Download translations
84+ uses : actions/download-artifact@v4
85+ with :
86+ name : translations-build
87+ path : ${{ env.PROJECT_FOLDER }}
88+
89+ - name : Amend gitignore to include compiled translations and add it to tracked files
90+ run : |
91+ # include compiled translations
92+ sed -i "s|^*.qm.*| |" .gitignore
93+
94+ # git add full project
95+ git add ${{ env.PROJECT_FOLDER }}/
96+
97+ - name : Package the latest version
98+ env :
99+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
100+ run : |
101+ qgis-plugin-ci package latest \
102+ --allow-uncommitted-changes \
103+ --plugin-repo-url $(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url')
104+
105+ - uses : actions/upload-artifact@v4
106+ with :
107+ name : ${{ env.PROJECT_FOLDER }}-latest
108+ path : |
109+ plugins.xml
110+ ${{ env.PROJECT_FOLDER }}.*.zip
111+ if-no-files-found : error
112+
113+ # -- ONLY TAGS ----------------------------------------------------------------------
114+ release :
115+ name : " 🚀 Release on tag"
116+ runs-on : ubuntu-latest
117+ permissions :
118+ contents : write
119+ needs :
120+ - translation
121+
122+ if : startsWith(github.ref, 'refs/tags/')
123+
124+ steps :
125+ - name : Checkout
126+ uses : actions/checkout@v4
127+
128+ - name : Setup Python
129+ uses : actions/setup-python@v5
130+ with :
131+ cache : " pip"
132+ cache-dependency-path : " requirements/packaging.txt"
133+ python-version : ${{ env.PYTHON_VERSION }}
134+
135+ - name : Install project requirements
136+ run : |
137+ python -m pip install -U pip setuptools wheel
138+ python -m pip install -U -r requirements/packaging.txt
139+
140+ - name : Download translations
141+ uses : actions/download-artifact@v4
142+ with :
143+ name : translations-build
144+ path : ${{ env.PROJECT_FOLDER }}
145+
146+ - name : Amend gitignore to include compiled translations and add it to tracked files
147+ run : |
148+ # include compiled translations
149+ sed -i "s|^*.qm.*| |" .gitignore
150+
151+ # git add full project
152+ git add ${{ env.PROJECT_FOLDER }}/
153+
154+ - name : Create GitHub Release
155+ uses : softprops/action-gh-release@v2
156+ with :
157+ fail_on_unmatched_files : true
158+ generate_release_notes : true
159+
160+ - name : Deploy plugin
161+ run : >-
162+ qgis-plugin-ci
163+ release ${GITHUB_REF/refs\/tags\//}
164+ --allow-uncommitted-changes
165+ --create-plugin-repo
166+ --github-token ${{ secrets.GITHUB_TOKEN }}
167+ --osgeo-username ${{ secrets.OSGEO_USER }}
168+ --osgeo-password ${{ secrets.OSGEO_PASSWORD }}
0 commit comments