-
Notifications
You must be signed in to change notification settings - Fork 90
159 lines (135 loc) · 6.73 KB
/
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
name: Release
on:
issue_comment:
types: created
jobs:
release:
name: Trigger release
runs-on: ubuntu-latest
if: github.event.comment.body == 'Trigger release' && (github.actor == 'sy6sy2' || github.actor == 'wwark' || github.actor == 'joaopa00')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out plugin repository master branch
uses: actions/checkout@v2
with:
fetch-depth: 0
path: master
ref: master
- name: Check out plugin repository dev branch
uses: actions/checkout@v2
with:
path: dev
ref: dev
- name: Set env
run: |
DEV_ADDON_XML_FP=dev/addon.xml
echo "* addon.xml filepath of dev branch: $DEV_ADDON_XML_FP"
CURRENT_DEV_VERSION=$(cat $DEV_ADDON_XML_FP|grep "<addon"|sed "s/.* version=\"\(.*\)\" .*/\1/")
echo "* Current dev version: $CURRENT_DEV_VERSION"
echo "CURRENT_DEV_VERSION=$CURRENT_DEV_VERSION" >> $GITHUB_ENV
RELEASE_VERSION=$(cat $DEV_ADDON_XML_FP|grep "<addon"|sed "s/.* version=\"\(.*\)~.*/\1/")
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "* Next release version: $RELEASE_VERSION"
NEXT_DEV_VERSION=$(MINOR=$(cat $DEV_ADDON_XML_FP|grep "<addon"|sed "s/.* version=\"\(.*\)~.*/\1/"|cut -d. -f3) && echo "0.2.$((MINOR+1))~beta00")
echo "NEXT_DEV_VERSION=$NEXT_DEV_VERSION" >> $GITHUB_ENV
echo "* Next beta version: $NEXT_DEV_VERSION"
PLUGIN_CHANGELOG=$(cat $DEV_ADDON_XML_FP|sed -n '/<news>/,/<\/news>/p'|sed 's#<news>##g'|sed 's#</news>##g'|sed '/^ *$/d'|tr '\n' '@'|sed 's#@#<br />#g')
echo "PLUGIN_CHANGELOG=$PLUGIN_CHANGELOG" >> $GITHUB_ENV
echo "* Changelog: $PLUGIN_CHANGELOG"
- name: Update master code with dev code
working-directory: master
run: |
git reset --hard origin/dev
- name: Set release version on master addon.xml file
working-directory: master
run: sed -i "s#version=\"$CURRENT_DEV_VERSION\"#version=\"$RELEASE_VERSION\"#g" ./addon.xml
- name: Commit release on master branch
working-directory: master
run: |
git config user.name 'Release workflow'
git config user.email '[email protected]'
git add --all
git commit -m "Version bump ($RELEASE_VERSION)"
git push origin --force
- name: Create plugin zip files for Kodi
id: prepare_zip
working-directory: master
run: |
mkdir plugin.video.catchuptvandmore
mv addon.py plugin.video.catchuptvandmore
mv addon.xml plugin.video.catchuptvandmore
mv fanart.jpg plugin.video.catchuptvandmore
mv icon.png plugin.video.catchuptvandmore
mv LICENSE.txt plugin.video.catchuptvandmore
mv service.py plugin.video.catchuptvandmore
mv resources plugin.video.catchuptvandmore
sed -i 's#<reuselanguageinvoker>false</reuselanguageinvoker>#<reuselanguageinvoker>true</reuselanguageinvoker>#g' plugin.video.catchuptvandmore/addon.xml
zip -r plugin.video.catchuptvandmore.zip plugin.video.catchuptvandmore
echo "::set-output name=zip_filepath::$(realpath plugin.video.catchuptvandmore.zip)"
rm plugin.video.catchuptvandmore/resources/lib/openvpn.py
rm plugin.video.catchuptvandmore/resources/lib/vpn.py
find plugin.video.catchuptvandmore -name '*.py' -exec sed -i '/# delete_for_submission_start/,/# delete_for_submission_end/d' {} \;
find plugin.video.catchuptvandmore -name '*.po' -exec sed -i '/# delete_for_submission_start/,/# delete_for_submission_end/d' {} \;
find plugin.video.catchuptvandmore -name '*.xml' -exec sed -i '/<!-- delete_for_submission_start -->/,/<!-- delete_for_submission_end -->/d' {} \;
zip -r plugin.video.catchuptvandmore-no-openvpn.zip plugin.video.catchuptvandmore
echo "::set-output name=zip_no_openvpn_filepath::$(realpath plugin.video.catchuptvandmore-no-openvpn.zip)"
- name: Prepare dev branch for next beta
working-directory: dev
run: |
git config user.name 'Release workflow'
git config user.email '[email protected]'
sed -i "s#version=\"$CURRENT_DEV_VERSION\"#version=\"$NEXT_DEV_VERSION\"#g" ./addon.xml
git add --all
git commit -m "Version bump ($NEXT_DEV_VERSION)"
git push origin
- name: Prepare GitHub release
id: prepare_release
run: |
echo "::set-output name=tag_name::$(echo v$RELEASE_VERSION)"
echo "::set-output name=release_name::$(echo v$RELEASE_VERSION)"
echo "::set-output name=body::$(echo $PLUGIN_CHANGELOG)"
- name: Create Release
id: create_release
uses: actions/create-release@latest
with:
tag_name: ${{ steps.prepare_release.outputs.tag_name }}
release_name: ${{ steps.prepare_release.outputs.release_name }}
body: ${{ steps.prepare_release.outputs.body }}
draft: false
prerelease: false
- name: Upload release zip file
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_zip.outputs.zip_filepath }}
asset_name: plugin.video.catchuptvandmore.zip
asset_content_type: application/zip
- name: Upload no openvpn release zip file
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.prepare_zip.outputs.zip_no_openvpn_filepath }}
asset_name: plugin.video.catchuptvandmore-no-openvpn.zip
asset_content_type: application/zip
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Check out repository.catchuptvandmore repository
uses: actions/checkout@v2
with:
repository: Catch-up-TV-and-More/repository.catchuptvandmore
token: ${{ secrets.GITHUB_ACTIONS_ACCESS_TOKEN }}
path: repository.catchuptvandmore
- name: Install dependencies
working-directory: repository.catchuptvandmore
run: pip install -r requirements.txt
- name: Configure git
working-directory: repository.catchuptvandmore
run: |
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
- name: Update all repositories
working-directory: repository.catchuptvandmore
run: ./update_all_repos.sh