watch for flutter updates #74682
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: watch for flutter updates | |
on: | |
# Check every 15 minutes | |
schedule: | |
- cron: "*/15 * * * *" | |
push: | |
branches: [ ci ] | |
pull_request: | |
branches: [ ci ] | |
workflow_dispatch: | |
jobs: | |
check-for-roll: | |
name: 'Check if stable engine commit changed' | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.check-roll.outputs.changed }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# We need to use a custom token here to be able to push commits. | |
token: ${{ secrets.ENGINE_ROLL_TOKEN }} | |
# If we only want to find out the stable engine version, we can do `wget -O engine.version.stable https://raw.githubusercontent.com/flutter/flutter/stable/bin/internal/engine.version` | |
# However we also want to find out the semver of the flutter release (3.0.5 for example), | |
- name: Download latest engine.version | |
run: wget -O engine.version.stable https://raw.githubusercontent.com/flutter/flutter/stable/bin/internal/engine.version | |
- name: Check if stable engine version changed | |
id: check-roll | |
run: | | |
git status | |
if git diff-index --quiet HEAD -- engine.version.stable; then | |
echo "No changes" | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "Delta" | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Log | |
run: | | |
echo '*** Stable engine commit changed? ***' | |
echo steps.check-roll.outputs.changed: ${{ steps.check-roll.outputs.changed }} | |
# reference: https://github.com/flutter/flutter/blob/a880c4ed3590477380c975f867406ba336834848/packages/flutter_tools/lib/src/version.dart#L703 | |
# if the flutter people ever decide to point more than one tags at the stable SDK commit we're in trouble here | |
- name: find out flutter SDK semver for this engine version | |
id: flutter-version | |
if: ${{ steps.check-roll.outputs.changed == 'true' }} | |
run: | | |
# read the engine.version.stable file to find the engine commit hash | |
# we're build for | |
ENGINE_HASH=$(cat engine.version.stable | tr -dc [:xdigit:]) | |
echo "hash=$ENGINE_HASH" >> $GITHUB_OUTPUT | |
- name: Commit new stable engine version | |
# the if is not really necessary since the add-and-commit action won't push empty commits, but this way it feels safer | |
# (it won't even push the tag if we have an empty commit) | |
if: ${{ steps.check-roll.outputs.changed == 'true' }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: 'Roll engine (stable)' | |
add: 'engine.version.stable' | |
tag: engine/${{ steps.flutter-version.outputs.hash }} --force | |
tag_push: '--force' |