2018-06-19 23:00:06 +02:00
|
|
|
// Copyright 2018 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:grinder/grinder.dart';
|
|
|
|
import 'package:path/path.dart' as p;
|
|
|
|
|
|
|
|
import 'utils.dart';
|
|
|
|
|
|
|
|
@Task('Update the Bazel rules for the current version.')
|
2018-06-26 01:39:35 +02:00
|
|
|
updateBazel() async {
|
2018-06-19 23:00:06 +02:00
|
|
|
ensureBuild();
|
|
|
|
|
2018-07-11 22:12:59 +02:00
|
|
|
run("npm", arguments: ["install", "-g", "yarn"]);
|
|
|
|
|
2018-06-19 23:00:06 +02:00
|
|
|
var repo = await cloneOrPull("https://github.com/bazelbuild/rules_sass.git");
|
|
|
|
|
|
|
|
var packageFile = new File(p.join(repo, "sass", "package.json"));
|
|
|
|
log("updating ${packageFile.path}");
|
|
|
|
packageFile.writeAsStringSync(packageFile
|
|
|
|
.readAsStringSync()
|
|
|
|
.replaceFirst(new RegExp(r'"sass": "[^"]+"'), '"sass": "$version"'));
|
|
|
|
|
2018-07-11 22:12:59 +02:00
|
|
|
run("yarn", workingDirectory: p.join(repo, "sass"));
|
|
|
|
|
2018-06-19 23:00:06 +02:00
|
|
|
run("git",
|
|
|
|
arguments: [
|
|
|
|
"commit",
|
|
|
|
"--all",
|
|
|
|
"--message",
|
|
|
|
"Update Dart Sass to $version"
|
|
|
|
],
|
|
|
|
workingDirectory: repo,
|
|
|
|
runOptions: sassBotEnvironment);
|
|
|
|
|
|
|
|
run("git",
|
|
|
|
arguments: ["tag", version],
|
|
|
|
workingDirectory: repo,
|
|
|
|
runOptions: sassBotEnvironment);
|
|
|
|
|
|
|
|
var username = environment('GITHUB_USER');
|
|
|
|
var password = environment('GITHUB_AUTH');
|
|
|
|
await runAsync("git",
|
|
|
|
arguments: [
|
|
|
|
"push",
|
|
|
|
"--tags",
|
|
|
|
"https://$username:$password@github.com/bazelbuild/rules_sass.git",
|
|
|
|
"master:master"
|
|
|
|
],
|
|
|
|
workingDirectory: repo);
|
|
|
|
}
|