-
Notifications
You must be signed in to change notification settings - Fork 26
98 lines (87 loc) · 3.33 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
# Based on https://github.com/im85288/service.upnext/blob/master/.github/workflows/release.yml
name: Make Release
on:
push:
tags:
- 'v*'
jobs:
release:
if: github.repository == 'XBMC-Addons/service.xbmc.versioncheck'
name: Make Release
runs-on: ubuntu-latest
steps:
- 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: |
changes=$(xmlstarlet sel -t -v '//news' -n addon.xml)
changes="${changes//'%'/'%25'}"
changes="${changes//$'\n'/'%0A'}"
changes="${changes//$'\r'/'%0D'}"
echo ::set-output name=changes::$changes
working-directory: ${{ github.event.repository.name }}
- name: Remove Unwanted Files
run: |
mv .git ..
rm -rf .??*
rm *.md
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Leia)
id: zip-leia
run: |
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
filename=${{ github.event.repository.name }}-${version}.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
echo ::set-output name=filename::$filename
working-directory: ${{ github.event.repository.name }}
- name: Create Zip (Matrix)
id: zip-matrix
run: |
xmlstarlet ed -L -u '//import[@addon="xbmc.python"]/@version' -v "3.0.0" addon.xml
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
xmlstarlet ed -L -u '/addon/@version' -v "${version}+matrix.1" addon.xml
version=$(xmlstarlet sel -t -v 'string(/addon/@version)' addon.xml)
filename=${{ github.event.repository.name }}-${version}.zip
cd ..
zip -r $filename ${{ github.event.repository.name }}
echo ::set-output name=filename::$filename
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.changes }}
draft: false
prerelease: false
- 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 (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