Skip to content

Commit b5a60a0

Browse files
authored
Merge pull request #492 from ant-media/update-embeded-player-automation
Create update-embedded-player.yml
2 parents 524c816 + 13bea6a commit b5a60a0

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

Comments
 (0)