2021-02-08 11:05:46 +00:00
|
|
|
name: auto-update
|
2021-02-08 10:53:24 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
2021-09-05 21:54:12 +00:00
|
|
|
- cron: '0 0,12 * * *'
|
2021-02-08 10:53:24 +00:00
|
|
|
jobs:
|
2021-12-12 04:08:26 +00:00
|
|
|
setup:
|
2021-08-02 01:13:25 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-08 21:54:29 +00:00
|
|
|
steps:
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
2022-02-11 18:07:16 +00:00
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
2023-01-20 21:58:53 +00:00
|
|
|
node-version: 16
|
2022-02-11 18:07:16 +00:00
|
|
|
cache: 'npm'
|
2022-03-23 17:05:00 +00:00
|
|
|
- run: npm run api:load
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-11-26 19:00:49 +00:00
|
|
|
with:
|
2022-02-11 18:07:16 +00:00
|
|
|
name: data
|
|
|
|
path: scripts/data
|
2021-12-12 04:08:26 +00:00
|
|
|
- run: npm install
|
2022-02-22 05:41:18 +00:00
|
|
|
- run: npm run db:create
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-12-12 04:08:26 +00:00
|
|
|
with:
|
|
|
|
name: database
|
2022-02-07 06:33:09 +00:00
|
|
|
path: scripts/database
|
2023-01-21 16:14:49 +00:00
|
|
|
- run: npm run db:matrix --silent >> $GITHUB_OUTPUT
|
2022-02-15 06:43:45 +00:00
|
|
|
id: create-matrix
|
2021-12-12 04:08:26 +00:00
|
|
|
outputs:
|
2023-01-20 21:58:53 +00:00
|
|
|
matrix: ${{ steps.create-matrix.outputs.MATRIX }}
|
2021-12-12 04:08:26 +00:00
|
|
|
load:
|
2021-09-08 21:54:29 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-12-12 04:08:26 +00:00
|
|
|
needs: setup
|
2021-08-03 05:33:07 +00:00
|
|
|
continue-on-error: true
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2023-01-20 21:58:53 +00:00
|
|
|
matrix: ${{ fromJson(needs.setup.outputs.MATRIX) }}
|
2022-08-20 17:42:57 +00:00
|
|
|
# matrix:
|
|
|
|
# cluster_id: [1]
|
2021-08-11 15:52:51 +00:00
|
|
|
steps:
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-03 01:49:41 +00:00
|
|
|
- name: Install ffmpeg
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -y
|
|
|
|
sudo apt-get install -y ffmpeg
|
|
|
|
ffmpeg -version
|
|
|
|
ffprobe -version
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/setup-node@v3
|
2021-12-12 04:08:26 +00:00
|
|
|
if: ${{ !env.ACT }}
|
2021-11-26 19:00:49 +00:00
|
|
|
with:
|
2023-01-20 21:58:53 +00:00
|
|
|
node-version: 16
|
|
|
|
- uses: actions/download-artifact@v3
|
2022-02-15 09:17:47 +00:00
|
|
|
with:
|
|
|
|
name: database
|
|
|
|
path: scripts/database
|
2021-12-12 04:08:26 +00:00
|
|
|
- run: npm install
|
2022-02-12 01:28:39 +00:00
|
|
|
- run: npm run cluster:load -- --cluster-id=${{ matrix.cluster_id }}
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-08-11 15:52:51 +00:00
|
|
|
with:
|
2021-12-12 04:08:26 +00:00
|
|
|
name: logs
|
|
|
|
path: scripts/logs
|
|
|
|
update:
|
2021-08-11 15:52:51 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-12-12 04:08:26 +00:00
|
|
|
needs: load
|
2021-08-03 05:33:07 +00:00
|
|
|
steps:
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-21 19:30:59 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-01-20 21:58:53 +00:00
|
|
|
- run: echo "BRANCH_NAME=$(date +'bot/auto-update-%s')" >> $GITHUB_OUTPUT
|
2021-12-12 04:08:26 +00:00
|
|
|
id: create-branch-name
|
2021-12-14 03:05:36 +00:00
|
|
|
- run: git config user.name 'iptv-bot[bot]'
|
|
|
|
- run: git config user.email '84861620+iptv-bot[bot]@users.noreply.github.com'
|
2023-01-20 21:58:53 +00:00
|
|
|
- run: git checkout -b ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
2022-02-15 06:43:45 +00: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 }}
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/setup-node@v3
|
2022-02-11 18:07:16 +00:00
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
2023-01-20 21:58:53 +00:00
|
|
|
node-version: 16
|
|
|
|
- uses: actions/download-artifact@v3
|
2021-12-12 04:08:26 +00:00
|
|
|
with:
|
2022-02-15 06:43:45 +00:00
|
|
|
name: data
|
2022-02-15 09:17:47 +00:00
|
|
|
path: scripts/data
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2022-02-07 06:33:09 +00:00
|
|
|
with:
|
2022-02-15 06:43:45 +00:00
|
|
|
name: database
|
2022-02-15 09:17:47 +00:00
|
|
|
path: scripts/database
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2021-12-12 04:08:26 +00:00
|
|
|
with:
|
|
|
|
name: logs
|
2022-02-15 09:17:47 +00:00
|
|
|
path: scripts/logs
|
2021-12-12 04:08:26 +00:00
|
|
|
- run: npm install
|
2022-02-12 01:28:39 +00:00
|
|
|
- run: npm run db:update
|
2022-08-24 00:23:26 +00:00
|
|
|
- run: npm run db:clear
|
2022-02-22 05:35:22 +00:00
|
|
|
- run: npm run db:export
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2022-08-10 01:39:14 +00:00
|
|
|
with:
|
|
|
|
name: api
|
|
|
|
path: .api
|
2022-08-14 23:22:55 +00:00
|
|
|
- run: npm run playlist:update
|
|
|
|
- run: npm run playlist:generate
|
2023-01-20 21:58:53 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
2021-12-12 22:17:46 +00:00
|
|
|
with:
|
|
|
|
name: logs
|
|
|
|
path: scripts/logs
|
2022-08-22 18:04:27 +00:00
|
|
|
- run: npm run readme:update
|
2022-02-22 05:13:16 +00:00
|
|
|
- name: Commit Changes
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
run: |
|
|
|
|
git add streams/*
|
2022-02-23 05:42:16 +00:00
|
|
|
git commit -m "[Bot] Update /streams"
|
2022-02-22 05:13:16 +00:00
|
|
|
git add README.md
|
|
|
|
git commit -m "[Bot] Update README.md"
|
|
|
|
git status
|
2023-01-20 21:58:53 +00:00
|
|
|
git push -u origin ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
2022-02-23 06:35:25 +00:00
|
|
|
- name: Deploy to gh-pages
|
2023-01-22 13:28:45 +00:00
|
|
|
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
2022-02-22 05:41:18 +00:00
|
|
|
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
|
2022-02-22 08:11:06 +00:00
|
|
|
commit-message: '[Bot] Deploy to GitHub Pages'
|
2023-01-20 14:19:38 +00:00
|
|
|
single-commit: true
|
|
|
|
clean: true
|
2022-02-23 06:35:25 +00:00
|
|
|
- name: Deploy to iptv-org/api
|
2023-01-22 13:28:45 +00:00
|
|
|
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
2022-02-22 05:41:18 +00:00
|
|
|
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
|
2022-12-30 20:31:24 +00:00
|
|
|
- uses: repo-sync/pull-request@v2.9
|
2022-02-24 16:22:09 +00:00
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
id: pull-request
|
|
|
|
with:
|
|
|
|
github_token: ${{ steps.create-app-token.outputs.token }}
|
2023-01-20 21:58:53 +00:00
|
|
|
source_branch: ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
2022-02-24 16:22:09 +00:00
|
|
|
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 }}
|
|
|
|
- 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
|