forked from anxdpanic/plugin.video.youtube
-
Notifications
You must be signed in to change notification settings - Fork 0
285 lines (267 loc) · 12.6 KB
/
make-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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# Based on https://github.com/im85288/service.upnext/blob/master/.github/workflows/release.yml
name: Make Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
- '*-dev'
jobs:
release:
if: github.repository == 'anxdpanic/plugin.video.youtube' || github.event_name == 'workflow_dispatch'
name: Make Release
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Release Status
id: release
run: |
version=${GITHUB_REF/refs\/tags\//}
if [[ $version == *[-+]@(alpha|beta|dev)*([.0-9a-z]) ]] ;
then
echo "pre-release=true" >> $GITHUB_OUTPUT
else
echo "pre-release=false" >> $GITHUB_OUTPUT
fi
- name: Checkout Add-on
uses: actions/checkout@v3
with:
path: ${{ github.event.repository.name }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libxml2-utils xmlstarlet zip
- name: Get Changelog
id: changelog
run: |
readarray -t changes < <(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt)
echo "body<<${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
for change in "${changes[@]}"; do
echo "${change}" >> $GITHUB_OUTPUT
done
news=$(printf '%s\n' "${changes[@]}" | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
echo "${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Nexus)
id: zip-nexus
run: |
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}" \
addon.xml
filename=${{ github.event.repository.name }}-${version}.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Nexus-Unofficial)
id: zip-unofficial-nexus
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git reset
git checkout .
git fetch origin nexus-unofficial
git -c user.email="\<\>" -c user.name="make-release" merge -X theirs --allow-unrelated-histories origin/nexus-unofficial
git clean -fdx
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}+unofficial.1" \
addon.xml
filename=${{ github.event.repository.name }}-${version}.unofficial.1.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Matrix)
id: zip-matrix
run: |
git reset
git checkout .
git clean -fdx
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}+matrix.1" \
-u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '3.0.0' \
-u '/addon/requires/import[@addon="inputstream.adaptive"]/@version' -v '19.0.0' \
-d '/addon/requires/import[@addon="script.module.infotagger"]' \
addon.xml
filename=${{ github.event.repository.name }}-${version}.matrix.1.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Matrix-Unofficial)
id: zip-unofficial-matrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git reset
git checkout .
git fetch origin nexus-unofficial
git -c user.email="\<\>" -c user.name="make-release" merge -X theirs --allow-unrelated-histories origin/nexus-unofficial
git clean -fdx
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}+matrix.unofficial.1" \
-u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '3.0.0' \
-u '/addon/requires/import[@addon="inputstream.adaptive"]/@version' -v '19.0.0' \
-d '/addon/requires/import[@addon="script.module.infotagger"]' \
addon.xml
filename=${{ github.event.repository.name }}-${version}.matrix.unofficial.1.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Leia)
id: zip-leia
run: |
git reset
git checkout .
git clean -fdx
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}+leia.1" \
-u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '2.26.0' \
-d '/addon/requires/import[@addon="script.module.requests"]/@version' \
-d '/addon/requires/import[@addon="inputstream.adaptive"]/@version' \
-d '/addon/requires/import[@addon="script.module.inputstreamhelper"]/@version' \
-d '/addon/requires/import[@addon="script.module.infotagger"]' \
-s '/addon/requires' -t elem -n import_temp \
-s '/addon/requires/import_temp' -t attr -n addon -v 'script.module.kodi-six' \
-s '/addon/requires/import_temp' -v import \
addon.xml
filename=${{ github.event.repository.name }}-${version}.leia.1.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Leia-Unofficial)
id: zip-unofficial-leia
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git reset
git checkout .
git fetch origin nexus-unofficial
git -c user.email="\<\>" -c user.name="make-release" merge -X theirs --allow-unrelated-histories origin/nexus-unofficial
git clean -fdx
mv .git ..
rm -rf .??*
rm *.md
news=$(awk '/^## /{rel_num++} {if(rel_num==2){exit} if(rel_num==1){print}}' changelog.txt | sed -E 's/ ?#[[:digit:]]+[., ]?//;s/\r//')
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -P -s '/addon/extension[@point="xbmc.addon.metadata"]' -t elem -n news -v "${news:0:1500}" \
-u '/addon/@version' -v "${version}+leia.unofficial.1" \
-u '/addon/requires/import[@addon="xbmc.python"]/@version' -v '2.26.0' \
-d '/addon/requires/import[@addon="script.module.requests"]/@version' \
-d '/addon/requires/import[@addon="inputstream.adaptive"]/@version' \
-d '/addon/requires/import[@addon="script.module.inputstreamhelper"]/@version' \
-d '/addon/requires/import[@addon="script.module.infotagger"]' \
-s '/addon/requires' -t elem -n import_temp \
-s '/addon/requires/import_temp' -t attr -n addon -v 'script.module.kodi-six' \
-s '/addon/requires/import_temp' -v import \
addon.xml
filename=${{ github.event.repository.name }}-${version}.leia.unofficial.1.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
mv .git ${{ github.event.repository.name }}
echo "filename=$filename" >> $GITHUB_OUTPUT
working-directory: ${{ github.event.repository.name }}
- name: Create 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: ${{ steps.changelog.outputs.body }}
draft: false
prerelease: ${{ steps.release.outputs.pre-release }}
- name: Upload Zip (Nexus)
id: upload-nexus
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-nexus.outputs.filename }}
asset_path: ${{ steps.zip-nexus.outputs.filename }}
asset_content_type: application/zip
- name: Upload Zip (Nexus-Unofficial)
id: upload-unofficial-nexus
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-unofficial-nexus.outputs.filename }}
asset_path: ${{ steps.zip-unofficial-nexus.outputs.filename }}
asset_content_type: application/zip
- name: Upload Zip (Matrix)
id: upload-matrix
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-matrix.outputs.filename }}
asset_path: ${{ steps.zip-matrix.outputs.filename }}
asset_content_type: application/zip
- name: Upload Zip (Matrix-Unofficial)
id: upload-unofficial-matrix
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-unofficial-matrix.outputs.filename }}
asset_path: ${{ steps.zip-unofficial-matrix.outputs.filename }}
asset_content_type: application/zip
- name: Upload Zip (Leia)
id: upload-leia
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-leia.outputs.filename }}
asset_path: ${{ steps.zip-leia.outputs.filename }}
asset_content_type: application/zip
- name: Upload Zip (Leia-Unofficial)
id: upload-unofficial-leia
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.zip-unofficial-leia.outputs.filename }}
asset_path: ${{ steps.zip-unofficial-leia.outputs.filename }}
asset_content_type: application/zip