2021-02-08 12:05:46 +01:00
|
|
|
name: auto-update
|
2021-02-08 11:53:24 +01:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
2021-09-05 23:54:12 +02:00
|
|
|
- cron: '0 0,12 * * *'
|
2021-02-08 11:53:24 +01:00
|
|
|
jobs:
|
2021-12-12 05:08:26 +01:00
|
|
|
setup:
|
2021-08-02 03:13:25 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-08 23:54:29 +02:00
|
|
|
steps:
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/checkout@v2
|
2022-02-11 19:07:16 +01:00
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
cache: 'npm'
|
|
|
|
- name: Download data from API
|
2022-02-06 22:04:56 +01:00
|
|
|
run: |
|
|
|
|
mkdir -p scripts/data
|
2022-02-14 10:00:05 +01:00
|
|
|
curl -L -o scripts/data/blocklist.json https://iptv-org.github.io/api/blocklist.json
|
2022-02-06 22:04:56 +01:00
|
|
|
curl -L -o scripts/data/categories.json https://iptv-org.github.io/api/categories.json
|
2022-02-14 10:00:05 +01:00
|
|
|
curl -L -o scripts/data/channels.json https://iptv-org.github.io/api/channels.json
|
2022-02-06 22:04:56 +01:00
|
|
|
curl -L -o scripts/data/countries.json https://iptv-org.github.io/api/countries.json
|
2022-02-14 10:00:05 +01:00
|
|
|
curl -L -o scripts/data/guides.json https://iptv-org.github.io/api/guides.json
|
2022-02-06 22:04:56 +01:00
|
|
|
curl -L -o scripts/data/languages.json https://iptv-org.github.io/api/languages.json
|
|
|
|
curl -L -o scripts/data/regions.json https://iptv-org.github.io/api/regions.json
|
2022-02-11 19:07:16 +01:00
|
|
|
- uses: actions/upload-artifact@v2
|
2021-11-26 20:00:49 +01:00
|
|
|
with:
|
2022-02-11 19:07:16 +01:00
|
|
|
name: data
|
|
|
|
path: scripts/data
|
2021-12-12 05:08:26 +01:00
|
|
|
- run: npm install
|
2022-02-22 06:35:22 +01:00
|
|
|
- run: npm run db:create
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: database
|
2022-02-07 07:33:09 +01:00
|
|
|
path: scripts/database
|
2022-02-15 07:43:45 +01:00
|
|
|
- run: npm run db:matrix
|
|
|
|
id: create-matrix
|
2021-12-12 05:08:26 +01:00
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.create-matrix.outputs.matrix }}
|
|
|
|
load:
|
2021-09-08 23:54:29 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-12-12 05:08:26 +01:00
|
|
|
needs: setup
|
2021-08-03 07:33:07 +02:00
|
|
|
continue-on-error: true
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-02-22 06:35:22 +01:00
|
|
|
matrix: ${{ fromJson(needs.setup.outputs.matrix) }}
|
|
|
|
# matrix:
|
|
|
|
# cluster_id: [1]
|
2021-08-11 17:52:51 +02:00
|
|
|
steps:
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: FedericoCarboni/setup-ffmpeg@v1
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
if: ${{ !env.ACT }}
|
2021-11-26 20:00:49 +01:00
|
|
|
with:
|
|
|
|
node-version: '14'
|
2022-02-15 10:17:47 +01:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: database
|
|
|
|
path: scripts/database
|
2021-12-12 05:08:26 +01:00
|
|
|
- run: npm install
|
2022-02-12 02:28:39 +01:00
|
|
|
- run: npm run cluster:load -- --cluster-id=${{ matrix.cluster_id }}
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/upload-artifact@v2
|
2021-08-11 17:52:51 +02:00
|
|
|
with:
|
2021-12-12 05:08:26 +01:00
|
|
|
name: logs
|
|
|
|
path: scripts/logs
|
|
|
|
update:
|
2021-08-11 17:52:51 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-12-12 05:08:26 +01:00
|
|
|
needs: load
|
2021-08-03 07:33:07 +02:00
|
|
|
steps:
|
2021-12-14 04:05:36 +01:00
|
|
|
- uses: actions/checkout@v2
|
2022-02-21 20:30:59 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-12-12 05:08:26 +01:00
|
|
|
- run: echo "::set-output name=branch_name::$(date +'bot/auto-update-%s')"
|
|
|
|
id: create-branch-name
|
2021-12-14 04:05:36 +01:00
|
|
|
- run: git config user.name 'iptv-bot[bot]'
|
|
|
|
- run: git config user.email '84861620+iptv-bot[bot]@users.noreply.github.com'
|
|
|
|
- run: git checkout -b ${{ steps.create-branch-name.outputs.branch_name }}
|
2022-02-15 07:43:45 +01:00
|
|
|
- uses: tibdex/github-app-token@v1
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
id: create-app-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
2022-02-11 19:07:16 +01:00
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
2022-02-15 07:43:45 +01:00
|
|
|
name: data
|
2022-02-15 10:17:47 +01:00
|
|
|
path: scripts/data
|
2022-02-07 07:33:09 +01:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
2022-02-15 07:43:45 +01:00
|
|
|
name: database
|
2022-02-15 10:17:47 +01:00
|
|
|
path: scripts/database
|
2021-12-12 05:08:26 +01:00
|
|
|
- uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: logs
|
2022-02-15 10:17:47 +01:00
|
|
|
path: scripts/logs
|
2021-12-12 05:08:26 +01:00
|
|
|
- run: npm install
|
2022-02-12 02:28:39 +01:00
|
|
|
- run: npm run db:update
|
2021-12-12 23:17:46 +01:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: database
|
2022-02-07 07:33:09 +01:00
|
|
|
path: scripts/database
|
2022-02-12 02:28:39 +01:00
|
|
|
- run: npm run playlist:update
|
|
|
|
- run: npm run playlist:generate
|
2022-02-22 06:35:22 +01:00
|
|
|
- run: npm run db:export
|
|
|
|
- run: npm run readme:update
|
2021-12-12 23:17:46 +01:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: logs
|
|
|
|
path: scripts/logs
|
2022-02-22 06:13:16 +01:00
|
|
|
- name: Commit Changes
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
run: |
|
|
|
|
git add streams/*
|
|
|
|
git commit -m "[Bot] Update streams"
|
|
|
|
git add README.md
|
|
|
|
git commit -m "[Bot] Update README.md"
|
|
|
|
git status
|
|
|
|
git push -u origin ${{ steps.create-branch-name.outputs.branch_name }}
|
2022-02-22 06:27:08 +01:00
|
|
|
- uses: repo-sync/pull-request@v2
|
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
id: pull-request
|
|
|
|
with:
|
|
|
|
github_token: ${{ steps.create-app-token.outputs.token }}
|
|
|
|
source_branch: ${{ steps.create-branch-name.outputs.branch_name }}
|
|
|
|
destination_branch: 'master'
|
|
|
|
pr_title: '[Bot] Daily update'
|
|
|
|
pr_body: |
|
|
|
|
This pull request is created by [auto-update][1] workflow.
|
|
|
|
|
|
|
|
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
|
2022-02-22 06:35:22 +01:00
|
|
|
- uses: JamesIves/github-pages-deploy-action@4.1.1
|
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
branch: gh-pages
|
|
|
|
folder: .gh-pages
|
|
|
|
token: ${{ steps.create-app-token.outputs.token }}
|
|
|
|
git-config-name: iptv-bot[bot]
|
|
|
|
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
|
|
|
|
commit-message: '[Bot] Generate playlists'
|
|
|
|
clean: false
|
|
|
|
- uses: JamesIves/github-pages-deploy-action@4.1.1
|
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
repository-name: iptv-org/api
|
|
|
|
branch: gh-pages
|
|
|
|
folder: .api
|
|
|
|
token: ${{ steps.create-app-token.outputs.token }}
|
|
|
|
git-config-name: iptv-bot[bot]
|
|
|
|
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
|
|
|
|
commit-message: '[Bot] Deploy to iptv-org/api'
|
|
|
|
clean: false
|
|
|
|
- uses: juliangruber/merge-pull-request-action@v1
|
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.PAT }}
|
|
|
|
number: ${{ steps.pull-request.outputs.pr_number }}
|
|
|
|
method: squash
|