-
Notifications
You must be signed in to change notification settings - Fork 115
160 lines (144 loc) · 6.47 KB
/
release-development-repository.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
name: Generate and Publish Development Repositories
on:
workflow_dispatch:
inputs:
prerelease:
description: 'Is this a pre-release? [true|false]'
required: false
default: 'true'
push:
tags:
- 'v*'
- '*-dev'
jobs:
repo-gen:
if: github.repository == 'anxdpanic/plugin.video.youtube' || github.event_name == 'workflow_dispatch'
name: Generate development repositories and upload them to mirrors
runs-on: ubuntu-22.04
permissions:
contents: write
strategy:
fail-fast: false
matrix:
python-version: [ '3.x' ]
steps:
- name: Get and set release status
# workflow_dispatch: use pre-release variable for release status
# push-tag: check tag for alpha|beta|dev to determine release status
id: release
run: |
version=${GITHUB_REF/refs\/tags\//}
prerelease=${{ github.event.inputs.prerelease }}
if [[ ! -z "${prerelease}" ]] ;
then
echo "pre-release=${prerelease}" >> $GITHUB_OUTPUT
elif [[ $version == *[-+]@(alpha|beta|dev)*([.0-9a-z]) ]] ;
then
echo "pre-release=true" >> $GITHUB_OUTPUT
else
echo "pre-release=false" >> $GITHUB_OUTPUT
fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
# install lftp for mirroring repository
# install lxml for repository generator script
run: |
sudo apt update
sudo apt install lftp
python -m pip install --upgrade pip
pip install lxml
- name: Checkout Official Branch (Unstable and Stable Releases)
# Check out the master branch to use for official [unstable|stable] add-on zip source
uses: actions/checkout@v4
with:
path: ./official_testing/${{ github.event.repository.name }}
ref: "master"
- name: Checkout Unofficial Branch (Unstable and Stable Releases)
# Check out the nexus-unofficial branch to use for unofficial [unstable|stable] add-on zip source
uses: actions/checkout@v4
with:
path: ./unofficial_testing/${{ github.event.repository.name }}
ref: "nexus-unofficial"
- name: Checkout Unofficial Branch (Stable Releases)
# Check out the nexus-unofficial branch to use for unofficial [stable] add-on zip source
if: steps.release.outputs.pre-release == 'false'
uses: actions/checkout@v4
with:
path: ./unofficial/${{ github.event.repository.name }}
ref: "nexus-unofficial"
- name: Copy Repository Generator
# Copy the repository generator script from master branch to cwd
run: |
cp ./official_testing/${{ github.event.repository.name }}/.scripts/.prepare_repository.py .
cp ./official_testing/${{ github.event.repository.name }}/.scripts/.config.json .
- name: Download Repository Add-on Files from FTP
# Download [un]official testing repository add-ons source from mirrors for generating new repository add-on zips from source
run: |
lftp -c "\
set ssl:verify-certificate false; \
set sftp:auto-confirm yes; \
open ${{ secrets.SFTP }}; \
cd /root/anxdpanic/kodi/youtube/; \
mirror --verbose --use-pget-n=8 -c --verbose repository.yt.testing_official ./official_testing/repository.yt.testing_official; \
mirror --verbose --use-pget-n=8 -c --verbose repository.yt.testing_unofficial ./unofficial_testing/repository.yt.testing_unofficial; \
bye \
"
- name: Download Unofficial Repository Add-on Files from FTP
# Download unofficial repository add-on source from mirrors for generating new repository add-on zips from source
if: steps.release.outputs.pre-release == 'false'
run: |
lftp -c "\
set ssl:verify-certificate false; \
set sftp:auto-confirm yes; \
open ${{ secrets.SFTP }}; \
cd /root/anxdpanic/kodi/youtube/; \
mirror --verbose --use-pget-n=8 -c --verbose repository.yt.unofficial ./unofficial/repository.yt.unofficial; \
bye \
"
- name: Generate Repositories
# Run the repository generator script to generate zips, addons.xml, and addons.xml.gz
run: |
python .prepare_repository.py --prerelease=${{ steps.release.outputs.pre-release }}
- name: Mirror Official Testing Repository to FTP (Unstable and Stable Releases)
# Mirror the generated official testing repository to the mirrors
# https://download.osmc.tv/dev/anxdpanic/kodi/youtube/official_testing/
run: |
lftp -c "\
set ssl:verify-certificate false; \
set sftp:auto-confirm yes; \
open ${{ secrets.SFTP }}; \
cd /root/anxdpanic/kodi/youtube/; \
lcd repository/; \
mirror --verbose --use-pget-n=8 -c --reverse --verbose official_testing official_testing; \
bye \
"
- name: Mirror Unofficial Testing Repository to FTP (Unstable and Stable Releases)
# Mirror the generated unofficial testing repository to the mirrors
# https://download.osmc.tv/dev/anxdpanic/kodi/youtube/unofficial_testing/
run: |
lftp -c "\
set ssl:verify-certificate false; \
set sftp:auto-confirm yes; \
open ${{ secrets.SFTP }}; \
cd /root/anxdpanic/kodi/youtube/; \
lcd repository/; \
mirror --verbose --use-pget-n=8 -c --reverse --verbose unofficial_testing unofficial_testing; \
bye \
"
- name: Mirror Unofficial Repository to FTP (Stable Releases)
# Mirror the generated unofficial repository to the mirrors
# https://download.osmc.tv/dev/anxdpanic/kodi/youtube/unofficial/
if: steps.release.outputs.pre-release == 'false'
run: |
lftp -c "\
set ssl:verify-certificate false; \
set sftp:auto-confirm yes; \
open ${{ secrets.SFTP }}; \
cd /root/anxdpanic/kodi/youtube/; \
lcd repository/; \
mirror --verbose --use-pget-n=8 -c --reverse --verbose unofficial unofficial; \
bye \
"