Skip to content

run: update dependencies #1

run: update dependencies

run: update dependencies #1

Workflow file for this run

name: Run update dependencies
on:
workflow_dispatch:
inputs:
traget_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_code_gen:
description: 'Whether to run code generation, 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 building example later, however, the android build will fail with the latest stable version, so we fixed use the 3.24.5 version here for now
# Here is the error log:
# Caused by: org.gradle.api.GradleException: You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is not possible anymore. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply
default: '3.24.5'
jobs:
update_deps:
runs-on: ubuntu-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
shell: bash
run: |
# Fetch all remote refs
git fetch --all
# Function to check if branch exists remotely
check_remote_branch() {
git ls-remote --heads origin "refs/heads/$1" | grep -q "refs/heads/$1$"
return $?
}
# Check if target_branch exists as a remote branch
if check_remote_branch "${{ inputs.target_branch }}"; then
echo "Target branch exists as a remote branch"
final_target_branch="${{ inputs.target_branch }}"
else
echo "Target branch does not exist as a remote branch, treating as a commit/tag reference"
# get pub_version from pubspec.yaml if inputs.pub_version is empty
pub_version=${{ inputs.pub_version }}
if [ -z "${pub_version}" ]; then
pub_version=$(grep 'version: ' pubspec.yaml | sed -e 's,.*: \(.*\),\1,')
fi
final_target_branch=special/${pub_version}
# create a new branch named "special/<pub_version>" from the reference
git checkout -B ${final_target_branch}
# push the new branch to the remote repository, set the result always as success even if the push failed
git push -u origin HEAD:${final_target_branch} || true
fi
echo "final_target_branch=${final_target_branch}" >> $GITHUB_OUTPUT
- 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: Setup Flutter
if: ${{ inputs.run_code_gen == true }}
uses: subosito/flutter-action@v2
with:
channel: ${{ inputs.flutter_channel }}
flutter-version: ${{ inputs.flutter_version }}
- name: Run code generation
if: ${{ inputs.run_code_gen == true }}
uses: AgoraIO-Extensions/actions/.github/actions/generate@main
with:
generate-code: true
generate-comment: false
working-directory: ./
generate-code-command: |
corepack enable && bash scripts/code_gen.sh ${{ inputs.code_gen_public_headers }}
generate-comment-command: ""
github-token: ${{ secrets.GITHUB_TOKEN }}
- 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