Skip to content

Commit

Permalink
workflow for updating flutter candidate (#6034)
Browse files Browse the repository at this point in the history
![](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExdjdjbjRkaGFhZHplNzUwd241Y2x4aTh4N2Zqdzk1aWRncHlvcGJtOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/11lz62kfEmsM00/giphy.gif)

This PR creates a workflow that will run daily to update the flutter-candidate.txt file. The objective of this is to have a daily resolution for flutter candidate versions, so in the future we know what version to use with legacy devtools versions.

Example of what the PR will look like.
#6037

Fixes #6024
  • Loading branch information
CoderDake authored Jul 14, 2023
1 parent 8c29992 commit ca1b3c0
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/daily-dev-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ jobs:
- name: setup git config
run: |
# TODO(https://github.com/flutter/devtools/issues/4949): Change the author to
# a flutter owned account
git config user.name "DevTools Workflow Bot"
git config user.email "[email protected]"
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/flutter-candidate-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Flutter Candidate Update
on:
workflow_dispatch: # Allows for manual triggering if needed
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 8 * * *" # Run every day at midnight Pacific Time

permissions:
contents: write
pull-requests: write

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
update-candidate:
name: Update Flutter Candidate Version
runs-on: ubuntu-latest
steps:
- name: git clone devtools
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
ref: master

- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f

- name: setup git config
run: |
git config user.name "DevTools Workflow Bot"
git config user.email "[email protected]"
- name: get the latest flutter candidate
run: |
set -ex
pushd tool/
dart pub get
popd
tool/latest_flutter_candidate.sh | sed 's|refs/tags/||' > flutter-candidate.txt
- name: Create the PR
run: |
set -ex
if ! [[ `git status --porcelain --untracked-files=no` ]]; then
# No changes made, so we can just exit.
echo "No change to the flutter-candidate.txt file"
exit
fi
COMMIT_MESSAGE="Changing Flutter Candidate to $(cat flutter-candidate.txt)"
BRANCH_NAME="auto-candidate-$(date +%s)"
# Stage the file, commit and push
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "$COMMIT_MESSAGE"
git push -u origin "$BRANCH_NAME"
PR_URL=$(gh pr create --title "$COMMIT_MESSAGE" --body "Automated Flutter candidate version bump.")
# Change github credentials back to the actions bot.
GH_TOKEN="$ORIGINAL_GH_TOKEN"
gh pr edit $PR_URL --add-label "autosubmit"
env:
GH_TOKEN: ${{ secrets.DEVTOOLS_WORKFLOW_BOT_TOKEN }}
ORIGINAL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13.0-2.0.pre
Loading

0 comments on commit ca1b3c0

Please sign in to comment.