diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index a87e888547..49423e3d21 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -293,6 +293,8 @@ jobs: ref: bot/auto-update - name: Download Artifacts uses: actions/download-artifact@v2 + with: + name: channels - name: Commit Changes uses: stefanzweifel/git-auto-commit-action@v4 with: @@ -310,22 +312,40 @@ jobs: uses: actions/checkout@v2 with: ref: bot/auto-update - - name: Generate Token - uses: tibdex/github-app-token@v1 - id: gh-pages-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Install Dependencies run: npm install - name: Generate Playlists run: node scripts/generate.js + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: gh-pages + path: .gh-pages/ + deploy: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + needs: generate + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/auto-update + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + name: gh-pages + - name: Generate Token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.1 with: branch: gh-pages folder: .gh-pages - token: ${{ steps.gh-pages-token.outputs.token }} + token: ${{ steps.generate-token.outputs.token }} git-config-name: iptv-bot git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com commit-message: '[Bot] Deploy to GitHub Pages' @@ -360,7 +380,7 @@ jobs: ref: bot/auto-update - name: Generate Token uses: tibdex/github-app-token@v1 - id: pr-token + id: generate-token with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} @@ -374,18 +394,18 @@ jobs: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }} committer: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>' - branch: bot/auto-update + branch: bot/auto-pull-request delete-branch: true token: ${{ steps.pr-token.outputs.token }} - name: Enable Pull Request Automerge - if: steps.pr.outputs.pull-request-operation == 'created' + if: steps.generate-token.outputs.pull-request-operation == 'created' uses: peter-evans/enable-pull-request-automerge@v1 with: token: ${{ secrets.PAT }} pull-request-number: ${{ steps.pr.outputs.pull-request-number }} merge-method: squash - name: Approve Pull Request - if: steps.pr.outputs.pull-request-operation == 'created' + if: github.ref == 'refs/heads/master' && steps.pr.outputs.pull-request-operation == 'created' uses: juliangruber/approve-pull-request-action@v1 with: github-token: ${{ secrets.PAT }}