303 lines
6.7 KiB
YAML
303 lines
6.7 KiB
YAML
name: auto-update
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
jobs:
|
|
remove-duplicates:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
- name: Remove Duplicates
|
|
run: node scripts/remove-duplicates.js
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: channels
|
|
path: channels/
|
|
filter:
|
|
runs-on: ubuntu-latest
|
|
needs: remove-duplicates
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
- name: Filter Playlists
|
|
run: node scripts/filter.js
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: channels
|
|
path: channels/
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
needs: filter
|
|
continue-on-error: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
country:
|
|
[
|
|
ad,
|
|
ae,
|
|
af,
|
|
al,
|
|
am,
|
|
ao,
|
|
ar,
|
|
at,
|
|
au,
|
|
aw,
|
|
az,
|
|
ba,
|
|
bb,
|
|
bd,
|
|
be,
|
|
bf,
|
|
bg,
|
|
bh,
|
|
bn,
|
|
bo,
|
|
br,
|
|
bs,
|
|
by,
|
|
ca,
|
|
cd,
|
|
cg,
|
|
ch,
|
|
ci,
|
|
cl,
|
|
cm,
|
|
cn,
|
|
co,
|
|
cr,
|
|
cu,
|
|
cw,
|
|
cy,
|
|
cz,
|
|
de,
|
|
dk,
|
|
do,
|
|
dz,
|
|
ec,
|
|
ee,
|
|
eg,
|
|
es,
|
|
et,
|
|
fi,
|
|
fj,
|
|
fo,
|
|
fr,
|
|
ge,
|
|
gh,
|
|
gm,
|
|
gn,
|
|
gp,
|
|
gq,
|
|
gr,
|
|
gt,
|
|
hk,
|
|
hn,
|
|
hr,
|
|
ht,
|
|
hu,
|
|
id,
|
|
ie,
|
|
il,
|
|
in,
|
|
iq,
|
|
ir,
|
|
is,
|
|
it,
|
|
jm,
|
|
jo,
|
|
jp,
|
|
ke,
|
|
kg,
|
|
kh,
|
|
kp,
|
|
kr,
|
|
kw,
|
|
kz,
|
|
la,
|
|
lb,
|
|
li,
|
|
lk,
|
|
lt,
|
|
lu,
|
|
lv,
|
|
ly,
|
|
ma,
|
|
mc,
|
|
md,
|
|
me,
|
|
mk,
|
|
ml,
|
|
mm,
|
|
mn,
|
|
mo,
|
|
mt,
|
|
mx,
|
|
my,
|
|
mz,
|
|
ne,
|
|
ng,
|
|
nl,
|
|
no,
|
|
np,
|
|
nz,
|
|
om,
|
|
pa,
|
|
pe,
|
|
ph,
|
|
pk,
|
|
pl,
|
|
pr,
|
|
ps,
|
|
pt,
|
|
py,
|
|
qa,
|
|
ro,
|
|
rs,
|
|
ru,
|
|
rw,
|
|
sa,
|
|
sd,
|
|
se,
|
|
sg,
|
|
si,
|
|
sk,
|
|
sl,
|
|
sm,
|
|
sn,
|
|
so,
|
|
sv,
|
|
sy,
|
|
th,
|
|
tj,
|
|
tm,
|
|
tn,
|
|
tr,
|
|
tt,
|
|
tw,
|
|
tz,
|
|
ua,
|
|
ug,
|
|
uk,
|
|
us,
|
|
uy,
|
|
uz,
|
|
va,
|
|
ve,
|
|
vi,
|
|
vn,
|
|
xk,
|
|
ye,
|
|
zm
|
|
]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Enable Cache
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '14'
|
|
cache: 'npm'
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
- name: Format Playlists
|
|
run: node scripts/format.js --country=${{ matrix.country }}
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: channels
|
|
path: channels/${{ matrix.country }}.m3u
|
|
generate:
|
|
runs-on: ubuntu-latest
|
|
needs: format
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
- name: Generate Playlists
|
|
run: node scripts/generate.js
|
|
- name: Deploy to GitHub Pages
|
|
uses: JamesIves/github-pages-deploy-action@4.1.1
|
|
with:
|
|
branch: gh-pages
|
|
folder: .gh-pages
|
|
update-readme:
|
|
runs-on: ubuntu-latest
|
|
needs: generate
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
- name: Update README.md
|
|
run: node scripts/update-readme.js
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: README.md
|
|
path: README.md
|
|
pull-request:
|
|
needs: update-readme
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Download /channels
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: channels
|
|
path: channels/
|
|
- name: Download README.md
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: README.md
|
|
- name: Generate Token
|
|
uses: tibdex/github-app-token@v1
|
|
id: generate-token
|
|
with:
|
|
app_id: ${{ secrets.APP_ID }}
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
- name: Create Pull Request
|
|
id: pr
|
|
uses: peter-evans/create-pull-request@v3
|
|
with:
|
|
title: '[Bot] Update playlists'
|
|
body: |
|
|
This pull request is created automatically by `auto-update` action.
|
|
commit-message: '[Bot] Update playlists'
|
|
committer: GitHub <noreply@github.com>
|
|
branch: bot/auto-update
|
|
delete-branch: true
|
|
token: ${{ steps.generate-token.outputs.token }}
|
|
- name: Enable Pull Request Automerge
|
|
if: steps.pr.outputs.pull-request-operation == 'created'
|
|
uses: peter-evans/enable-pull-request-automerge@v1
|
|
with:
|
|
token: ${{ secrets.PAT }}
|
|
pull-request-number: ${{ steps.pr.outputs.pull-request-number }}
|
|
merge-method: squash
|
|
- name: Approve Pull Request
|
|
if: steps.pr.outputs.pull-request-operation == 'created'
|
|
uses: juliangruber/approve-pull-request-action@v1
|
|
with:
|
|
github-token: ${{ secrets.PAT }}
|
|
number: ${{ steps.pr.outputs.pull-request-number }}
|