Update workflows

This commit is contained in:
freearhey
2025-10-08 21:26:10 +03:00
parent 3cb2edd94f
commit 40221ab2d2
4 changed files with 213 additions and 273 deletions

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: changed files
- name: Get list of changed files
id: files
run: |
git fetch origin master:master
@@ -23,14 +23,19 @@ jobs:
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }}
if: steps.files.outputs.any_changed == 'true'
with:
node-version: 22
cache: 'npm'
- name: install dependencies
- name: Setup .npmrc for GitHub Packages
run: |
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
if: steps.files.outputs.any_changed == 'true'
run: npm install
- name: validate
- name: Validate changed files
if: steps.files.outputs.any_changed == 'true'
run: |
npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }}

View File

@@ -1,10 +1,6 @@
name: format
on:
workflow_dispatch:
# pull_request:
# types: [closed]
# branches:
# - master
# schedule:
# - cron: "0 12 * * *"
jobs:
@@ -28,19 +24,20 @@ jobs:
with:
node-version: 22
cache: 'npm'
- name: setup git
- name: Setup .npmrc for GitHub Packages
run: |
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
- name: install dependencies
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
run: npm install
- name: format internal playlists
- name: Format internal playlists
run: npm run playlist:format
- name: check internal playlists
- name: Check internal playlists
run: |
npm run playlist:lint
npm run playlist:validate
- name: changed files
- name: Get list of changed files
id: files_after
run: |
ANY_CHANGED=false
@@ -50,82 +47,16 @@ jobs:
fi
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- name: git status
run: git status
- name: commit changes
if: steps.files_after.outputs.any_changed == 'true'
run: |
git add streams
git status
git commit -m "[Bot] Format /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [format](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify
- name: push all changes to the repository
if: ${{ !env.ACT && github.ref == 'refs/heads/master' && steps.files_after.outputs.any_changed == 'true' }}
run: git push
on_merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1.8.2
if: ${{ !env.ACT }}
id: create-app-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
if: ${{ !env.ACT }}
with:
token: ${{ steps.create-app-token.outputs.token }}
- name: changed files
id: files
run: |
ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ')
if [ -n "${ALL_CHANGED_FILES}" ]; then
ANY_CHANGED=true
fi
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4
if: ${{ steps.files.outputs.any_changed == 'true' }}
with:
node-version: 22
cache: 'npm'
- name: setup git
if: steps.files.outputs.any_changed == 'true'
- name: Setup git
run: |
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
- name: install dependencies
if: steps.files.outputs.any_changed == 'true'
run: npm install
- name: format internal playlists
if: steps.files.outputs.any_changed == 'true'
run: npm run playlist:format -- ${{ steps.files.outputs.all_changed_files }}
- name: check internal playlists
if: steps.files.outputs.any_changed == 'true'
run: |
npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }}
npm run playlist:validate -- ${{ steps.files.outputs.all_changed_files }}
- name: git status
if: steps.files.outputs.any_changed == 'true'
run: git status
- name: changed files
id: files_after
run: |
ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ')
if [ -n "${ALL_CHANGED_FILES}" ]; then
ANY_CHANGED=true
fi
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- name: commit changes
- name: Commit changes to /streams
if: steps.files_after.outputs.any_changed == 'true'
run: |
git add streams
git status
git commit -m "[Bot] Format /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [format](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify
- name: push all changes to the repository
- name: Push all changes to the repository
if: ${{ !env.ACT && github.ref == 'refs/heads/master' && steps.files_after.outputs.any_changed == 'true' }}
run: git push

View File

@@ -4,6 +4,7 @@ on:
schedule:
- cron: '0 0 * * *'
permissions:
actions: write
issues: write
jobs:
stale:

View File

@@ -7,56 +7,59 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1.8.2
if: ${{ !env.ACT }}
id: create-app-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: ${{ !env.ACT }}
with:
token: ${{ steps.create-app-token.outputs.token }}
- name: setup git
run: |
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
- uses: actions/setup-node@v3
if: ${{ !env.ACT }}
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'npm'
- name: install dependencies
- name: Setup .npmrc for GitHub Packages
run: |
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Install dependencies
run: npm install
- name: update internal playlists
- name: Update internal playlists
run: npm run playlist:update --silent >> $GITHUB_OUTPUT
id: playlist-update
- name: check internal playlists
- name: Check internal playlists
run: |
npm run playlist:lint
npm run playlist:validate
- name: generate public playlists
- name: Generate public playlists
run: npm run playlist:generate
- name: generate .api/streams.json
- name: Generate .api/streams.json
run: npm run api:generate
- name: update readme
- name: Update readme
run: npm run readme:update
- run: git status
- name: commit changes to /streams
- name: Setup git
run: |
git config user.name "iptv-bot[bot]"
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
- name: Commit changes to /streams
run: |
git add streams
git status
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
- name: commit changes to playlists.md
- name: Commit changes to PLAYLIST.md
run: |
git add PLAYLISTS.md
git status
git commit --allow-empty -m "[Bot] Update PLAYLISTS.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
- name: push all changes to the repository
- name: Push all changes to the repository
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
run: git push
- name: deploy public playlists to github pages
- name: Deploy public playlists to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.1
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
with:
@@ -68,7 +71,7 @@ jobs:
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
commit-message: '[Bot] Deploy to GitHub Pages'
clean: true
- name: move .api/streams.json to iptv-org/api
- name: Move .api/streams.json to iptv-org/api
uses: JamesIves/github-pages-deploy-action@4.1.1
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
with: