-
Notifications
You must be signed in to change notification settings - Fork 18
206 lines (166 loc) · 6.19 KB
/
build_release.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: "📦 Build & 🚀 Release"
env:
PROJECT_FOLDER: "qgis_resource_sharing"
PYTHON_VERSION: 3.9
on:
push:
branches: [master]
tags:
- "*"
pull_request:
branches: [master]
paths:
- .github/workflows/build_release.yml
jobs:
translation:
name: "💬 i18n compilation"
runs-on: ubuntu-latest
steps:
- name: Get source code
uses: actions/checkout@v3
- name: Install system requirements
run: |
sudo apt update
sudo apt install qt5-default qttools5-dev-tools
- name: Update translations
run: lupdate -noobsolete -verbose ${{ env.PROJECT_FOLDER }}/resources/i18n/plugin_translation.pro
- name: Compile translations
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
- uses: actions/upload-artifact@v3
with:
name: translations-build
path: ${{ env.PROJECT_FOLDER }}/**/*.qm
if-no-files-found: error
dependencies:
name: "🧱 Dependencies build"
runs-on: windows-latest
steps:
- name: Get source code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/embedded.txt"
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install --no-deps -U -r requirements/embedded.txt -t ${{ env.PROJECT_FOLDER }}/ext_libs
- name: Cleaning up
shell: bash
run: |
rm -rf `find ${{ env.PROJECT_FOLDER }} -type d -name __pycache__`
rm -rf `find ${{ env.PROJECT_FOLDER }} -type d -name *.dist-info`
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name docs`
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name tests`
rm -rf `find ${{ env.PROJECT_FOLDER }}/ext_libs -type d -name test`
- uses: actions/upload-artifact@v3
with:
name: dependencies-build
path: ${{ env.PROJECT_FOLDER }}/ext_libs/
if-no-files-found: error
# -- NO TAGS ----------------------------------------------------------------------
packaging:
name: "📦 Packaging plugin"
runs-on: ubuntu-latest
needs: [translation, dependencies]
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/packaging.txt"
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/packaging.txt
- name: Download translations
uses: actions/download-artifact@v3
with:
name: translations-build
path: ${{ env.PROJECT_FOLDER }}
- name: Download dependencies
uses: actions/download-artifact@v3
with:
name: dependencies-build
path: ${{ env.PROJECT_FOLDER }}/ext_libs/
- name: List files
run: tree ${{ env.PROJECT_FOLDER }}
- name: Amend gitignore to include compiled translations and add it to tracked files
run: |
# include compiled translations and dependencies
sed -i "s|^*.qm.*| |" .gitignore
sed -i "s|^${{ env.PROJECT_FOLDER }}/ext_libs/.*| |" .gitignore
# git add full project
git add ${{ env.PROJECT_FOLDER }}/
- name: Package the latest version
run: qgis-plugin-ci package latest --allow-uncommitted-changes
- uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_FOLDER }}-latest
path: ${{ env.PROJECT_FOLDER }}.*.zip
if-no-files-found: error
# -- ONLY TAGS ----------------------------------------------------------------------
release:
name: "🚀 Release"
runs-on: ubuntu-latest
needs: [translation, dependencies]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Get tag name as version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/packaging.txt"
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/packaging.txt
- name: Download translations
uses: actions/download-artifact@v3
with:
name: translations-build
path: ${{ env.PROJECT_FOLDER }}
- name: Download dependencies
uses: actions/download-artifact@v3
with:
name: dependencies-build
path: ${{ env.PROJECT_FOLDER }}/ext_libs/
- name: Amend gitignore to include compiled translations and add it to tracked files
run: |
# include compiled translations and dependencies
sed -i "s|^*.qm.*| |" .gitignore
sed -i "s|^${{ env.PROJECT_FOLDER }}/ext_libs/.*| |" .gitignore
# git add full project
git add ${{ env.PROJECT_FOLDER }}/
- name: Get current changelog for ${VERSION}
run: qgis-plugin-ci changelog ${GITHUB_REF/refs\/tags\//} >> release.md
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: release.md
- name: Deploy plugin
run: >-
qgis-plugin-ci
release ${GITHUB_REF/refs\/tags\//}
--github-token ${{ secrets.GITHUB_TOKEN }}
--create-plugin-repo
--allow-uncommitted-changes
--osgeo-username ${{ secrets.OSGEO_USER }}
--osgeo-password ${{ secrets.OSGEO_PASSWORD }}