|
| 1 | +name: Update @antmedia/web_player Dependency |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [update-embedded-player] |
| 6 | + |
| 7 | +jobs: |
| 8 | + update-dependency: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + |
| 13 | + - name: Use Node.js |
| 14 | + uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: '18' |
| 17 | + |
| 18 | + - name: Update @antmedia/web_player |
| 19 | + working-directory: ./embedded-player |
| 20 | + run: | |
| 21 | + OLD_EMBEDDED_PLAYER_VERSION=$(node -p "require('./package.json').dependencies['@antmedia/web_player']") |
| 22 | + npm install --save @antmedia/web_player@latest || { echo 'npm install failed' ; exit 1; } |
| 23 | + NEW_EMBEDDED_PLAYER_VERSION=$(node -p "require('./package.json').dependencies['@antmedia/web_player']") |
| 24 | + echo "OLD_EMBEDDED_PLAYER_VERSION=$OLD_EMBEDDED_PLAYER_VERSION" >> $GITHUB_ENV |
| 25 | + echo "NEW_EMBEDDED_PLAYER_VERSION=$NEW_EMBEDDED_PLAYER_VERSION" >> $GITHUB_ENV |
| 26 | +
|
| 27 | + - name: Commit changes if version updated |
| 28 | + if: env.OLD_EMBEDDED_PLAYER_VERSION != env.NEW_EMBEDDED_PLAYER_VERSION |
| 29 | + working-directory: ./embedded-player |
| 30 | + run: | |
| 31 | + git config user.name github-actions |
| 32 | + git config user.email [email protected] |
| 33 | + git add package.json package-lock.json |
| 34 | + git commit -m "Update @antmedia/web_player from ${{ env.OLD_EMBEDDED_PLAYER_VERSION }} to ${{ env.NEW_EMBEDDED_PLAYER_VERSION }}" |
| 35 | +
|
| 36 | + - name: Create Pull Request |
| 37 | + if: env.OLD_EMBEDDED_PLAYER_VERSION != env.NEW_EMBEDDED_PLAYER_VERSION |
| 38 | + uses: peter-evans/[email protected] |
| 39 | + with: |
| 40 | + title: "Update @antmedia/web_player to ${{ env.NEW_EMBEDDED_PLAYER_VERSION }}" |
| 41 | + body: | |
| 42 | + This PR updates the @antmedia/web_player dependency from ${{ env.OLD_EMBEDDED_PLAYER_VERSION }} to ${{ env.NEW_EMBEDDED_PLAYER_VERSION }}. |
| 43 | + |
| 44 | + Triggered by publish-release.yml from web player repo. |
| 45 | + branch: update-antmedia-web-player-${{ env.NEW_EMBEDDED_PLAYER_VERSION }} |
| 46 | + delete-branch: true |
0 commit comments