run: update dependencies #16
This file contains hidden or 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: 'run: update dependencies' | |
on: | |
workflow_dispatch: | |
inputs: | |
target_branch: | |
description: 'Target branch to compare against. If a branch name, will compare directly against it. If a commit hash or tag, a new branch named "special/<pub_version>" will be created from that ref. The pub_version will be either the input pub_version or latest version from target branch pubspec.yaml. Defaults to "main".' | |
type: string | |
required: true | |
default: 'main' | |
pub_version: | |
description: 'Target pub version to update dependencies to. If empty, will use the latest version from target branch pubspec.yaml.' | |
type: string | |
required: false | |
default: '' | |
dependencies_content: | |
description: 'The dependencies content to update, including native SDKs and Iris dependencies across Maven, CocoaPods, and CDN links' | |
type: string | |
required: true | |
default: '' | |
run_gen_code: | |
description: 'Whether to run gen code, default is false' | |
type: boolean | |
required: false | |
default: false | |
code_gen_public_headers: | |
description: 'The public headers to generate, e.g. rtc_4.5.0, leave empty will use the same as the target branch' | |
type: string | |
required: false | |
default: '' | |
flutter_channel: | |
description: 'Target Flutter channel, e.g. stable(default), beta, dev, master (or main), or any other channel name' | |
type: string | |
required: false | |
default: 'stable' | |
flutter_version: | |
description: 'Target Flutter version, e.g. 3.24.5, 3.24.x, commit hash, or leave empty to use the latest release version of specified channel by flutter_version(default)' | |
type: string | |
required: false | |
# we should use the latest stable version for build and gen code, but the 3.19.6 is the latest version which will gen compatible code for our flutter project, | |
# so we fixed use the 3.19.6 version here for now | |
default: '3.19.6' | |
jobs: | |
update_deps: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout target branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.target_branch }} | |
fetch-depth: '1' | |
lfs: 'true' | |
submodules: 'true' | |
- name: Parse dependencies content | |
id: parse_dependencies_content | |
if: ${{ inputs.dependencies_content != '' }} | |
uses: AgoraIO-Extensions/actions/.github/actions/dep@main | |
with: | |
dependencies-content: ${{ inputs.dependencies_content }} | |
# Output: {steps.parse_dependencies_content.outputs.matches}, the parsed dependencies content in json format, the format is as follows: | |
# [ | |
# { | |
# "iris_cdn": [ | |
# "https://download.agora.io/sdk/release/iris_4.5.0-gxz.119_DCG_Mac_Video_Unity_20250217_0847_579.zip", | |
# "https://download.agora.io/sdk/release/iris_4.5.0-gxz.119_DCG_Mac_Video_Standalone_20250217_0847_579.zip", | |
# "https://download.agora.io/sdk/release/iris_4.5.0-gxz.119_DCG_Mac_Video_20250217_0847_579.zip" | |
# ], | |
# "cdn": [ | |
# "https://download.agora.io/sdk/release/AgoraRtcEngine_macOS_Preview_4.5.0-gxz.119.zip" | |
# ], | |
# "iris_cocoapods": [ | |
# "pod 'AgoraIrisRTC_macOS', '4.5.0-gxz.119'" | |
# ], | |
# "iris_maven": [ | |
# "implementation 'io.agora.rtc:iris-rtc:4.5.0-gxz.119'" | |
# ], | |
# "maven": [ | |
# "implementation 'io.agora.rtc:agora-full-preview:4.5.0-gxz.119'", | |
# "implementation 'io.agora.rtc:full-screen-sharing-special:4.5.0-gxz.119'" | |
# ], | |
# "platform": "macOS", // iOS, macOS, Android, Windows, Web | |
# "cocoapods": [ | |
# "pod 'AgoraRtcEngine_macOS_Preview', '4.5.0-gxz.119'" | |
# ] | |
# }, | |
# ] | |
- name: Prepare target branch | |
id: prepare_target_branch | |
uses: ./.github/actions/prepare_branch | |
with: | |
target_branch: ${{ inputs.target_branch }} | |
pub_version: ${{ inputs.pub_version }} | |
branch_group: "special" | |
working_directory: ./ | |
- name: Update dependencies with parsed dependencies content | |
if: ${{ inputs.dependencies_content != '' }} | |
shell: bash | |
run: | | |
# call ci/run_update_deps.sh with output of steps.parse_dependencies_content.outputs.matches | |
bash ci/run_update_deps.sh ${{ steps.parse_dependencies_content.outputs.matches }} | |
- name: Update pub version into pubspec.yaml | |
if: ${{ inputs.pub_version != '' }} | |
shell: bash | |
run: | | |
# Update pub version into pubspec.yaml | |
sed -i '' "s/version: .*/version: ${{ inputs.pub_version }}/" pubspec.yaml | |
- name: Run gen code | |
if: ${{ inputs.run_gen_code == true }} | |
uses: ./.github/actions/gen_code | |
with: | |
code_gen_public_headers: ${{ inputs.code_gen_public_headers }} | |
flutter_channel: ${{ inputs.flutter_channel }} | |
flutter_version: ${{ inputs.flutter_version }} | |
working_directory: ./ | |
- name: Commit and create pull request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "feat: update dependencies" | |
committer: GitHub <noreply@github.com> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
branch: dev/${{ steps.prepare_target_branch.outputs.final_target_branch }} | |
base: ${{ steps.prepare_target_branch.outputs.final_target_branch }} | |
delete-branch: true | |
draft: false | |
title: "feat: update dependencies" | |
body: | | |
Update dependencies with the following content: | |
${{ inputs.dependencies_content }} | |
> This pull request is trigger by bot, you can checkout this branch and update it. | |
labels: | | |
ci:ready_release_special | |