iptv/.github/workflows/auto-update.yml

419 lines
11 KiB
YAML
Raw Normal View History

2021-02-08 12:05:46 +01:00
name: auto-update
2021-02-08 11:53:24 +01:00
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
2021-08-02 03:13:25 +02:00
create-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:18:18 +02:00
with:
2021-08-03 06:30:37 +02:00
ref: ${{ github.ref }}
2021-08-03 06:20:34 +02:00
- name: Create Branch
uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'bot/auto-update'
2021-08-02 21:02:53 +02:00
format:
2021-05-06 15:24:54 +02:00
runs-on: ubuntu-latest
2021-08-02 03:13:25 +02:00
needs: create-branch
2021-05-06 15:24:54 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-05-06 15:24:54 +02:00
- name: Install Dependencies
run: npm install
2021-08-02 21:02:53 +02:00
- name: Format Playlists
run: node scripts/format.js
2021-08-02 03:13:25 +02:00
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
2021-05-26 14:58:54 +02:00
with:
2021-08-02 21:02:53 +02:00
commit_message: '[Bot] Formate playlists'
2021-08-02 04:01:39 +02:00
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
2021-08-02 03:52:32 +02:00
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-02 03:13:25 +02:00
branch: bot/auto-update
2021-08-02 03:41:01 +02:00
file_pattern: channels/*
2021-08-02 21:02:53 +02:00
remove-duplicates:
2021-05-26 14:58:54 +02:00
runs-on: ubuntu-latest
2021-08-02 21:02:53 +02:00
needs: format
2021-07-13 18:18:04 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-07-13 18:18:04 +02:00
- name: Install Dependencies
run: npm install
2021-08-02 21:02:53 +02:00
- name: Remove Duplicates
run: node scripts/remove-duplicates.js
2021-08-02 03:13:25 +02:00
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
2021-07-13 18:18:04 +02:00
with:
2021-08-02 21:02:53 +02:00
commit_message: '[Bot] Remove duplicates'
2021-08-02 04:01:39 +02:00
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
2021-08-02 03:52:32 +02:00
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-02 03:13:25 +02:00
branch: bot/auto-update
2021-08-02 03:41:01 +02:00
file_pattern: channels/*
2021-08-02 20:34:54 +02:00
sort:
2021-07-13 18:18:04 +02:00
runs-on: ubuntu-latest
2021-08-02 21:02:53 +02:00
needs: remove-duplicates
2021-08-01 06:13:18 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-08-02 20:34:54 +02:00
- name: Install Dependencies
run: npm install
- name: Sort Channels
run: node scripts/sort.js
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[Bot] Sort channels'
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
branch: bot/auto-update
file_pattern: channels/*
filter:
runs-on: ubuntu-latest
needs: sort
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: bot/auto-update
2021-08-01 06:13:18 +02:00
- name: Install Dependencies
run: npm install
2021-08-02 19:23:49 +02:00
- name: Filter Playlists
run: node scripts/filter.js
2021-08-02 03:13:25 +02:00
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
2021-08-01 06:13:18 +02:00
with:
2021-08-02 19:23:49 +02:00
commit_message: '[Bot] Filter channels'
2021-08-02 04:01:39 +02:00
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
2021-08-02 03:52:32 +02:00
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-02 03:13:25 +02:00
branch: bot/auto-update
2021-08-02 03:41:01 +02:00
file_pattern: channels/*
2021-08-01 06:13:18 +02:00
detect-resolution:
runs-on: ubuntu-latest
2021-08-02 19:23:49 +02:00
needs: filter
2021-08-01 02:58:47 +02:00
continue-on-error: true
strategy:
fail-fast: false
matrix:
2021-08-03 02:24:20 +02:00
country: [
# ad,
# ae,
# af,
# ag,
# al,
# am,
an
# 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,
# mv,
# mx,
# my,
# mz,
# ne,
# ng,
# ni,
# 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
2021-08-01 02:58:47 +02:00
]
2021-05-26 14:58:54 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-05-26 14:58:54 +02:00
- name: Install Dependencies
run: npm install
2021-08-01 06:13:18 +02:00
- name: Detect Resolution
run: node scripts/detect-resolution.js --country=${{ matrix.country }}
2021-05-26 14:58:54 +02:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: channels
2021-08-01 02:58:47 +02:00
path: channels/${{ matrix.country }}.m3u
2021-08-02 03:13:25 +02:00
commit-changes:
2021-05-26 14:58:54 +02:00
runs-on: ubuntu-latest
2021-08-01 06:13:18 +02:00
needs: detect-resolution
2021-05-26 14:58:54 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-05-26 14:58:54 +02:00
- name: Download Artifacts
uses: actions/download-artifact@v2
2021-08-03 02:23:24 +02:00
with:
name: channels
2021-08-02 03:13:25 +02:00
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
2021-08-02 03:41:01 +02:00
commit_message: '[Bot] Detect resolution'
2021-08-02 04:01:39 +02:00
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
2021-08-02 03:52:32 +02:00
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-02 03:13:25 +02:00
branch: bot/auto-update
2021-08-02 03:41:01 +02:00
file_pattern: channels/*
2021-08-02 03:13:25 +02:00
generate:
runs-on: ubuntu-latest
needs: commit-changes
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: bot/auto-update
2021-08-03 02:23:24 +02:00
- name: Install Dependencies
run: npm install
- name: Generate Playlists
run: node scripts/generate.js
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: gh-pages
path: .gh-pages/
deploy:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: generate
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: bot/auto-update
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: gh-pages
2021-08-03 01:44:05 +02:00
- name: Generate Token
uses: tibdex/github-app-token@v1
2021-08-03 02:23:24 +02:00
id: generate-token
2021-08-03 01:44:05 +02:00
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
2021-02-08 11:53:24 +01:00
- name: Deploy to GitHub Pages
2021-04-17 02:47:33 +02:00
uses: JamesIves/github-pages-deploy-action@4.1.1
2021-04-17 02:53:32 +02:00
with:
branch: gh-pages
2021-08-03 02:55:23 +02:00
folder: gh-pages
2021-08-03 02:23:24 +02:00
token: ${{ steps.generate-token.outputs.token }}
2021-08-03 01:44:05 +02:00
git-config-name: iptv-bot
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
commit-message: '[Bot] Deploy to GitHub Pages'
2021-05-26 14:58:54 +02:00
update-readme:
runs-on: ubuntu-latest
needs: generate
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-02 03:13:25 +02:00
with:
ref: bot/auto-update
2021-05-26 14:58:54 +02:00
- name: Install Dependencies
run: npm install
2021-02-08 11:53:24 +01:00
- name: Update README.md
run: node scripts/update-readme.js
2021-08-02 03:41:01 +02:00
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
2021-05-26 14:37:13 +02:00
with:
2021-08-02 03:41:01 +02:00
commit_message: '[Bot] Update README.md'
2021-08-02 04:01:39 +02:00
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
2021-08-02 03:52:32 +02:00
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-02 03:41:01 +02:00
branch: bot/auto-update
file_pattern: README.md
2021-05-26 15:10:28 +02:00
pull-request:
needs: update-readme
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2021-08-03 04:34:41 +02:00
with:
2021-08-03 05:20:11 +02:00
ref: bot/auto-update
2021-05-26 17:23:27 +02:00
- name: Generate Token
uses: tibdex/github-app-token@v1
2021-08-03 02:23:24 +02:00
id: generate-token
2021-05-26 17:23:27 +02:00
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
2021-08-03 06:45:05 +02:00
- name: Fetch Origin
run: git fetch origin
2021-08-03 05:59:20 +02:00
- name: Update from master
2021-08-03 06:45:05 +02:00
run: git merge origin/master
2021-05-26 15:10:28 +02:00
- name: Create Pull Request
2021-05-26 16:16:58 +02:00
id: pr
2021-05-26 15:10:28 +02:00
uses: peter-evans/create-pull-request@v3
with:
title: '[Bot] Update playlists'
body: |
2021-08-03 03:30:15 +02:00
This pull request is created by [auto-update][1] workflow.
2021-08-02 04:43:08 +02:00
2021-08-03 03:30:15 +02:00
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
2021-08-03 02:55:23 +02:00
author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
2021-08-03 05:43:08 +02:00
branch: 'bot/auto-update'
delete-branch: false
2021-08-03 05:25:03 +02:00
base: master
2021-08-03 03:01:16 +02:00
token: ${{ steps.generate-token.outputs.token }}
2021-05-26 17:23:27 +02:00
- name: Enable Pull Request Automerge
2021-08-03 03:30:15 +02:00
if: steps.pr.outputs.pull-request-operation == 'created'
2021-05-26 16:16:58 +02:00
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.pr.outputs.pull-request-number }}
merge-method: squash
2021-05-26 16:44:04 +02:00
- name: Approve Pull Request
2021-08-03 02:23:24 +02:00
if: github.ref == 'refs/heads/master' && steps.pr.outputs.pull-request-operation == 'created'
2021-05-26 16:44:04 +02:00
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.PAT }}
number: ${{ steps.pr.outputs.pull-request-number }}