|
| 1 | +# Copyright 2026 The Chromium Authors. All rights reserved. |
| 2 | +# Use of this source code is governed by a BSD-style license that can be |
| 3 | +# found in the LICENSE file. |
| 4 | + |
| 5 | +name: Update Flutter SDK Pin |
| 6 | + |
| 7 | +on: |
| 8 | + schedule: |
| 9 | + - cron: '0 0 * * 1' # Run every Monday at midnight UTC |
| 10 | + workflow_dispatch: # Allow manual execution from the Actions tab |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + pull-requests: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + check-and-update: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout Repository |
| 21 | + uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + token: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }} |
| 24 | + |
| 25 | + - name: Check for New Flutter stable version |
| 26 | + id: check-version |
| 27 | + run: | |
| 28 | + # 1. Retrieve the current pinned version from the shared script |
| 29 | + CURRENT_VERSION=$(grep -E 'FLUTTER_VERSION="[0-9.]+"' tool/provision_flutter.sh | head -n 1 | cut -d'"' -f2) |
| 30 | + echo "Current pinned version: $CURRENT_VERSION" |
| 31 | +
|
| 32 | + # 2. Retrieve the latest stable version from Flutter's official releases manifest |
| 33 | + LATEST_VERSION=$(curl -s https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json | jq -r '.releases | map(select(.channel == "stable"))[0].version') |
| 34 | + echo "Latest stable version: $LATEST_VERSION" |
| 35 | +
|
| 36 | + # 3. Compare and update if a newer version is available |
| 37 | + if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then |
| 38 | + echo "New Flutter stable version detected: $LATEST_VERSION" |
| 39 | + sed -i -e "s/FLUTTER_VERSION=\"$CURRENT_VERSION\"/FLUTTER_VERSION=\"$LATEST_VERSION\"/g" tool/provision_flutter.sh |
| 40 | + echo "updated=true" >> $GITHUB_OUTPUT |
| 41 | + echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT |
| 42 | + else |
| 43 | + echo "Flutter SDK is already up to date." |
| 44 | + echo "updated=false" >> $GITHUB_OUTPUT |
| 45 | + fi |
| 46 | +
|
| 47 | + - name: Create Pull Request for Version Bump |
| 48 | + if: steps.check-version.outputs.updated == 'true' |
| 49 | + uses: peter-evans/create-pull-request@v8 |
| 50 | + with: |
| 51 | + token: ${{ secrets.FLUTTERACTIONSBOT_CP_TOKEN }} |
| 52 | + push-to-fork: flutteractionsbot/flutter-intellij |
| 53 | + committer: flutteractionsbot <flutter-actions-bot@google.com> |
| 54 | + author: flutteractionsbot <flutter-actions-bot@google.com> |
| 55 | + commit-message: "ci: bump pinned Flutter SDK to version ${{ steps.check-version.outputs.latest_version }}" |
| 56 | + title: "ci: bump pinned Flutter SDK to version ${{ steps.check-version.outputs.latest_version }}" |
| 57 | + body: | |
| 58 | + An automated check has detected a new stable release of the Flutter SDK. |
| 59 | + |
| 60 | + * **New Pinned Version**: `${{ steps.check-version.outputs.latest_version }}` |
| 61 | + |
| 62 | + This Pull Request updates our shared provisioning script (`tool/provision_flutter.sh`) to target this version. All presubmit tests will be run against this version to verify compatibility. |
| 63 | + branch: "auto-update-flutter-sdk" |
| 64 | + delete-branch: true |
| 65 | + labels: | |
| 66 | + dependencies |
| 67 | + ci |
0 commit comments