Create SDK update PR #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create SDK update PR | |
on: | |
workflow_dispatch: | |
inputs: | |
sdk_name: | |
description: 'The SDK for which the version should be updated' | |
required: true | |
type: choice | |
options: | |
- android | |
- ios | |
version_number: | |
description: 'The version number to which the SDK should be updated' | |
required: true | |
type: string | |
jobs: | |
update: | |
name: Update SDK version | |
runs-on: macos-latest | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup git user | |
run: | | |
git config --global user.name "Update Bot" | |
git config --global user.email "[email protected]" | |
- name: Set update branch name | |
id: branching | |
run: | | |
branch_name="update_${{ inputs.sdk_name }}_player_to_${{ inputs.version_number }}" | |
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT | |
- name: Create update branch | |
run: | | |
git push origin --delete ${{ steps.branching.outputs.branch_name }} || true | |
git checkout -b ${{ steps.branching.outputs.branch_name }} | |
- name: Setup node and npm registry | |
if: ${{ inputs.sdk_name == 'ios' }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org/' | |
cache: 'yarn' | |
- name: Bump iOS player SDK version | |
if: ${{ inputs.sdk_name == 'ios' }} | |
run: | | |
sed -i '' 's/s.dependency "BitmovinPlayer", ".*/s.dependency "BitmovinPlayer", "${{ inputs.version_number }}"/g' RNBitmovinPlayer.podspec | |
yarn install --frozen-lockfile --cwd example | |
cd example/ios | |
pod repo add bitmovin https://github.com/bitmovin/cocoapod-specs.git | |
pod update BitmovinPlayer | |
- name: Bump Android player SDK version | |
if: ${{ inputs.sdk_name == 'android' }} | |
run: | | |
sed -i '' "s/com.bitmovin.player:player:.*/com.bitmovin.player:player:${{ inputs.version_number }}'/g" android/build.gradle | |
- name: Commit version bump | |
run: | | |
git add RNBitmovinPlayer.podspec android/build.gradle example/ios/Podfile.lock | |
git commit -m "chore(${{ inputs.sdk_name }}): update ${{ inputs.sdk_name }} player version to ${{ inputs.version_number }}" | |
git push origin ${{ steps.branching.outputs.branch_name }} | |
- name: Create PR | |
run: | | |
gh pr create \ | |
--base "${{ github.ref }}" \ | |
--title "Update ${{ inputs.sdk_name == 'ios' && 'iOS' || inputs.sdk_name }} player to ${{ inputs.version_number }}" \ | |
--body "Automated ${{ inputs.sdk_name == 'ios' && 'iOS' || inputs.sdk_name }} player version update to ${{ inputs.version_number }}" |