iptv/.github/workflows/update.yml

83 lines
3.2 KiB
YAML
Raw Normal View History

2023-06-21 12:15:44 +02:00
name: update
on:
workflow_dispatch:
schedule:
2023-09-15 17:40:49 +02:00
- cron: '0 0 * * *'
2023-06-21 12:15:44 +02:00
jobs:
main:
runs-on: ubuntu-latest
steps:
2023-06-25 13:16:58 +02:00
- uses: actions/checkout@v3
2023-09-22 05:32:05 +02:00
- uses: tibdex/github-app-token@v1.8.2
2023-06-21 12:15:44 +02:00
if: ${{ !env.ACT }}
id: create-app-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
if: ${{ !env.ACT }}
with:
token: ${{ steps.create-app-token.outputs.token }}
2023-09-15 17:40:49 +02:00
- name: setup git
run: |
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
2023-06-21 12:15:44 +02:00
- uses: actions/setup-node@v3
2023-09-15 17:40:49 +02:00
if: ${{ !env.ACT }}
2023-06-21 12:15:44 +02:00
with:
node-version: 18
cache: 'npm'
- name: install dependencies
run: npm install
2023-09-15 17:40:49 +02:00
- name: update internal playlists
run: npm run playlist:update --silent >> $GITHUB_OUTPUT
id: playlist-update
- name: check internal playlists
2023-06-21 12:15:44 +02:00
run: |
npm run playlist:lint
npm run playlist:validate
2023-09-15 17:40:49 +02:00
- name: generate public playlists
2023-06-21 12:15:44 +02:00
run: npm run playlist:generate
2023-09-15 17:40:49 +02:00
- name: generate .api/streams.json
2023-06-21 12:15:44 +02:00
run: npm run api:generate
- name: update readme.md
run: npm run readme:update
2023-09-15 17:40:49 +02:00
- run: git status
- name: commit changes to /streams
run: |
git add streams
git status
2023-09-18 04:59:04 +02:00
git commit --allow-empty -m "[Bot] Update /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." -m "${{ steps.playlist-update.outputs.OUTPUT }}" --no-verify
2023-09-15 17:40:49 +02:00
- name: commit changes to readme.md
run: |
git add README.md
git status
2023-09-18 04:59:04 +02:00
git commit --allow-empty -m "[Bot] Update README.md" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify
2023-09-15 17:40:49 +02:00
- name: push all changes to the repository
2023-06-25 14:27:23 +02:00
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
2023-09-15 17:40:49 +02:00
run: git push
- name: deploy public playlists to github pages
2023-06-25 13:16:58 +02:00
uses: JamesIves/github-pages-deploy-action@4.1.1
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
with:
repository-name: iptv-org/iptv
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] Deploy to GitHub Pages'
2023-06-25 14:33:08 +02:00
clean: true
2023-09-15 17:40:49 +02:00
- name: move .api/streams.json to iptv-org/api
2023-06-25 13:16:58 +02:00
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