diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 21dcc633b7..4069239009 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -29,12 +29,12 @@ jobs: path: scripts/data - run: npm install - run: npm run db:create - - run: npm run db:matrix - id: create-matrix - uses: actions/upload-artifact@v2 with: name: database path: scripts/database + - run: npm run db:matrix + id: create-matrix outputs: matrix: ${{ steps.create-matrix.outputs.matrix }} load: @@ -73,23 +73,28 @@ jobs: - 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 }} - - run: curl -L -o scripts/data/codes.json https://iptv-org.github.io/epg/codes.json + - 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 }} - uses: actions/setup-node@v2 if: ${{ !env.ACT }} with: node-version: '14' - - uses: actions/download-artifact@v2 - with: - name: database - path: scripts - uses: actions/download-artifact@v2 with: name: data path: scripts + - uses: actions/download-artifact@v2 + with: + name: database + path: scripts - uses: actions/download-artifact@v2 with: name: logs - path: scripts/logs + path: scripts - run: npm install - run: npm run db:update - uses: actions/upload-artifact@v2 @@ -97,23 +102,38 @@ jobs: name: database path: scripts/database - run: npm run playlist:update - - run: git add channels/* - - run: git commit -m "[Bot] Update playlists" + - run: git add streams/* + - run: git commit -m "[Bot] Update streams" - run: npm run playlist:generate - uses: actions/upload-artifact@v2 with: name: logs path: scripts/logs + - 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' + - run: npm run db:export + - 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 - run: npm run readme:update - run: git add README.md - run: git commit -m "[Bot] Update README.md" - run: git push -u origin ${{ steps.create-branch-name.outputs.branch_name }} - - 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 }} - uses: repo-sync/pull-request@v2 if: ${{ !env.ACT }} id: pull-request @@ -127,17 +147,8 @@ jobs: [1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }} - uses: juliangruber/merge-pull-request-action@v1 - if: ${{ github.ref == 'refs/heads/master' }} + if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} with: github-token: ${{ secrets.PAT }} number: ${{ steps.pull-request.outputs.pr_number }} method: squash - - uses: JamesIves/github-pages-deploy-action@4.1.1 - if: ${{ 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'