Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/daily-dev-bump.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Daily Dev Bump
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 * * *' # Run every day at midnight
workflow_dispatch: # Allows for manual triggering if needed

permissions:
contents: write

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

jobs:
bump-dev-version:
name: Bump Dev Version
runs-on: ubuntu-latest
steps:
- name: git clone devtools
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
ref: master

- uses: dart-lang/setup-dart@v1.3

- 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 "Dan Chevalier's GitHub Actions Bot"
git config user.email "chevalier.dan@gmail.com"

- name: Bump the Dev Version
id: version-bump
run: |
set -x
pushd tool/
dart pub get
popd

CURRENT_VERSION=$(dart tool/update_version.dart current-version)
if ! echo "$CURRENT_VERSION" |grep -Eq "\-dev\.[0-9]+" ; then
ERROR_DESCRIPTION="Doing \
a Dev bump on a release version ($CURRENT_VERSION) is not supported. \
Ensure that that current version has been properly bumped to a '-dev.*' \
pre-release version, in order to continue daily dev bumps."

echo "::error ,title=Cannot Bump A Release Version ($CURRENT_VERSION)::$ERROR_DESCRIPTION"
exit 1;
fi

# Get the commit message
COMMIT_MESSAGE=$(dart tool/update_version.dart auto --dry-run --type dev)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT

# Do the update
dart tool/update_version.dart auto --type dev

- name: commit
run: |
# Stage the file, commit and push

git commit -a -m "$COMMIT_MESSAGE"
git push
env:
COMMIT_MESSAGE: ${{ steps.version-bump.outputs.COMMIT_MESSAGE }}
31 changes: 26 additions & 5 deletions tool/update_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ void main(List<String> args) async {
'A program for updating the devtools version',
)
..addCommand(ManualUpdateCommand())
..addCommand(AutoUpdateCommand());
..addCommand(AutoUpdateCommand())
..addCommand(CurrentVersionCommand());
runner.run(args).catchError((error) {
if (error is! UsageException) throw error;
print(error);
Expand All @@ -32,8 +33,11 @@ void main(List<String> args) async {
return;
}

Future<void> performTheVersionUpdate(
{required String currentVersion, required String newVersion}) async {
Future<void> performTheVersionUpdate({
required String currentVersion,
required String newVersion,
bool modifyChangeLog = true,
}) async {
print('Updating pubspecs from $currentVersion to version $newVersion...');

for (final pubspec in _pubspecs) {
Expand All @@ -46,8 +50,10 @@ Future<void> performTheVersionUpdate(
newVersion,
);

print('Updating CHANGELOG to version $newVersion...');
writeVersionToChangelog(File('CHANGELOG.md'), newVersion);
if (modifyChangeLog) {
print('Updating CHANGELOG to version $newVersion...');
writeVersionToChangelog(File('CHANGELOG.md'), newVersion);
}

print('Updating index.html to version $newVersion...');
writeVersionToIndexHtml(
Expand Down Expand Up @@ -284,6 +290,18 @@ class ManualUpdateCommand extends Command {
}
}

class CurrentVersionCommand extends Command {
@override
final name = 'current-version';
@override
final description = 'Print the current devtools_app version.';

@override
void run() async {
print(versionFromPubspecFile());
}
}

class AutoUpdateCommand extends Command {
@override
final name = 'auto';
Expand Down Expand Up @@ -343,6 +361,7 @@ class AutoUpdateCommand extends Command {
final type = argResults!['type'].toString();
final isDryRun = argResults!['dry-run'];
final currentVersion = versionFromPubspecFile();
bool modifyChangeLog = true;
String? newVersion;
if (currentVersion == null) {
throw 'Could not automatically determine current version.';
Expand All @@ -353,6 +372,7 @@ class AutoUpdateCommand extends Command {
break;
case 'dev':
newVersion = incrementDevVersion(currentVersion);
modifyChangeLog = false;
break;
default:
newVersion = incrementVersionByType(currentVersion, type);
Expand All @@ -369,6 +389,7 @@ class AutoUpdateCommand extends Command {
performTheVersionUpdate(
currentVersion: currentVersion,
newVersion: newVersion,
modifyChangeLog: modifyChangeLog,
);
}
}