Merge pull request #277 from sass/release

Further release process improvements
This commit is contained in:
Natalie Weizenbaum 2018-03-29 14:16:27 -07:00 committed by GitHub
commit 5a38c42ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 50 deletions

View File

@ -96,7 +96,10 @@ jobs:
- stage: deploy
if: &deploy-if
(type IN (push, api)) AND (repo = sass/dart-sass) AND tag =~ ^\d+\.\d+\.\d+([+-].*)?$
env: DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
env:
- DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0 GITHUB_USER=sassbot
# GITHUB_AUTH="..."
- secure: "AAP74aT+8SQmwGeHrCsZ7GgppvCCkDAZXszivocMy3Fi9gfMCLABBCh67pGINJX4VlLW7ftPF3xivlvgGu+e4ncXz9m9jIPZ9Iza3cW5jCnCgyRGZD98gwabIDFWiv4X9V2xnJA2p1ZuYBf8Sh3TTipUFBKMjlnxVxYkIOTud4rUss/htFhxVA/oFTo0ThTZwXuxJ+GRGTM4PcuHPJvPf18iRPs2AHFV6ZP51xgc3AsXC6Zyom5EJeX0yGj9zWQ0XCjnuFdGsI6G9jmkrmqgAXuUipgqAn0tjxPYp9R/1HqnBLD3Zbrvyi5pCiSFclU6CS6kTDbefzPOc5+zrnlkaolVeF8tQ+EhZiZqtLnpLYUz9bgknoFUapUN4N0R36sKBStdRv54+sMeoOzpQ8ep3PeZW5nWbak12wcrDx38ToWs6hQ4ycb0SQDZZatHsASpSu2nX8HwzZSDAZmsAdB+epPmgA0CBjWVG1ycmVnT6l3OopUmbaY3pXBNzFUXq5Fcd7Q39/MfrmHpyxSc3QVf8xNtUx9ggYtK0Kwx6dgykhNMVzFGZRVyQgwpaiyDqgMGEU2GQzzcJhgKo9+y1fDtdfj/cctmvJ2Fo1fkk+DMkEPUHGOVo6uKFnartky9iLm1WiHDMruJ6SIOJzAnb+TMBWQTSwI+F4wyEiRVR8Zv4uA="
script: skip # Don't run tests
deploy:
@ -122,10 +125,38 @@ jobs:
# Deploy to Chocolatey from stable because Chocolatey often doesn't support
# the latest dev channel SDK release.
- if: *deploy-if
env: DART_CHANNEL=stable DART_VERSION=latest
env:
- DART_CHANNEL=stable DART_VERSION=latest
# CHOCO_TOKEN="..."
- secure: "cW11kQYBBEElfVsc1pJfVEHOMYwt0ZK+9STZHwSPbAISlplIRnsimMN7TqCY2aLnkWXyUMU7DphIl9uQ86M4BT1bJopsHbapj27bFSlKWHlBSDB/xylFHywV41Yk5lMlr8DLMbsSzVahasyR34xS6HYIRlDpZ9TFiQuDQNJxQmqTZJg/FC+3nqCI7tyMKGkWc48ikTcmqDMHsG9CudG2u+Q3S9sLNXArh9T4tSnAyWkTvSrS05mvFx5tC83PcG9/VkioTId+VRSJchwTmCxDFDROrTikTXZMtYn8wMAQ2wQ34TQXNZMZ9uiHA6W0IuJV2EnYerJbqV2lrJq9xqZywKu6HW6i4GhrCvizALNFZx/N7s/10xuf3UcuWizYml/e0MYT+6t4ojTYBMKv+Cx+H2Y2Jdpvdn2ZAIl6LaU3pLw4OIPJ7aXjDwZd63MPxtwGwVLHbH7Zu+oUv1erIq5LtatuocGWipD8WdiMBQvyCuDRMowpLPoAbj+mevOf+xlY2Eym4tOXpxM7iY3lXFHROo5dQbhsARfVF9J1gl5PuYXvCjxqTfK/ef9t3ZoDbi57+yAJUWlZfWa5r1zKE8OS0pA8GfQRLom/Lt0wKVw4Xiofgolzd9pEHi4JpsYIQb8O+u1ACQU6nBCS87CGrQ+ylnzKfGUs0aW2K3gvbkg0LUg="
script: skip
deploy:
provider: script
script: tool/deploy-to-chocolatey.sh
script: pub run grinder update_chocolatey
skip_cleanup: true
on: {tags: true}
# Redeploy sass-lang.com when a build succeeds.
- stage: site
if: *deploy-if
env:
# HEROKU_TOKEN="..."
- secure: "jF3TCL+k6xdXWfEh54K6KrZ3w0oljUpP0uy9Hx0BIM5gaqG6fUijUnNGCkWDZxufEpl68mGxNRNMB2Mv++UXHiT7ChFx8zZqEyc5FzhIu/nVO3CP3Sek7fuktYidtUvqJ6eHkI15990dWkUoE+TTXTc4/Z9vv1Lt3JX8Ni5VApGCmcLjRwW52EkCC49xo7cWE8/wBEm2ntOivLBIXEKq6hpncXTO4H5KYt042WAJ+MPmQZYE1ENJAObXWrGituRCT6DQnIJuTodOn24SU1KJuvEtfskEJQUajIIQw29uvmu4TP7dgaJw8QBt+hdgcCYrMhoq3RTNmD+vitLRloG4QMWHFYhzONVZ8S3vAhKeolL7nnIz150FpLVQiddSLsdGomqjCfYEJN7TVrwvunGgHxygcGBcq2AiydnxREnlW9Rj6m6g6TVlhdX7JtyePDQN7xEDdZF1UbGMA6CDjzFsi0GY2WNLSCAANUOXmst0kDIFHGc6WkIUXMIbfmkUZADKzF/JDtnEQqtU8Qxc8JfW6ODXqC/fowE3q4cr8NnJMtclyIL/DsWSx2ph3vUr/VH5MWXd4MDJ6ZRnSJHaY2E0IYcKU2JEpA8r7xrFK/+/B9qCMPnoegRFfuN+zHM9b84rNzaF8fmuWuMVKzncw/TvXttRFqoZVS2Ej1EfLY3SA3M="
install: skip
script: skip
deploy:
provider: script
# Heroku doesn't have a public API endpoint for this yet, so we use the
# private endpoint instead.
script: >
curl https://kolkrabbi.heroku.com/apps/98fc74a8-ff56-4a21-85f6-7a1fc8ba95c9/github/push
-H "Content-Type: application/json"
-H "Accept: application/json, text/javascript, */*; q=0.01"
-H "Authorization: Bearer $HEROKU_TOKEN"
-H "accept-encoding: gzip, deflate, br"
-H "accept-language: en-US,en;q=0.9"
-H "origin: https://dashboard.heroku.com"
-H "referer: https://dashboard.heroku.com/"
-d '{"branch":"master"}'
--fail --output -

View File

@ -1,24 +0,0 @@
#!/bin/bash -e
# 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.
openssl aes-256-cbc -K $encrypted_d18df560dfb2_key -iv $encrypted_d18df560dfb2_iv -in tool/encrypted/credentials.tar.enc \
-out credentials.tar -d
tar xfO credentials.tar choco > choco
function travis_cmd() {
echo "\$ $@"
"$@"
}
travis_fold() {
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r"
}
travis_fold start chocolatey
travis_cmd pub run grinder update_chocolatey
travis_fold end chocolatey

View File

@ -3,13 +3,12 @@
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
openssl aes-256-cbc -K $encrypted_d18df560dfb2_key -iv $encrypted_d18df560dfb2_iv -in tool/encrypted/credentials.tar.enc \
openssl aes-256-cbc -K $encrypted_d472b0f964cc_key -iv $encrypted_d472b0f964cc_iv -in tool/encrypted/credentials.tar.enc \
-out credentials.tar -d
mkdir -p ~/.pub-cache
tar xfO credentials.tar npm > ~/.npmrc
tar xfO credentials.tar pub > ~/.pub-cache/credentials.json
tar xfO credentials.tar git > ~/.netrc
function travis_cmd() {
echo "\$ $@"

Binary file not shown.

View File

@ -312,8 +312,7 @@ update_chocolatey() async {
var request = new http.MultipartRequest(
"PUT", Uri.parse("https://push.chocolatey.org/api/v2/package"));
request.headers["X-NuGet-Protocol-Version"] = "4.1.0";
request.headers["X-NuGet-ApiKey"] =
new File("choco").readAsStringSync().trim();
request.headers["X-NuGet-ApiKey"] = _environment("CHOCO_TOKEN");
request.files.add(await http.MultipartFile
.fromPath("package", "build/sass.${_chocolateyVersion()}.nupkg"));
@ -529,9 +528,8 @@ update_homebrew() async {
@Task('Release the current version as to GitHub.')
@Depends(package)
github_release() async {
var authorization = _loadAuthorization();
var authorization = _githubAuthorization();
// We don't explicitly authenticate here, we just rely on Travis's .netrc.
var client = new http.Client();
var response = await client.post(
"https://api.github.com/repos/sass/dart-sass/releases",
@ -638,21 +636,18 @@ String _lastChangelogSection() {
return buffer.toString().trim();
}
/// A regular expression to match the api.github.com entry in a .netrc file.
final _netrcRegExp = new RegExp(r"(?:^|\n) *machine api\.github\.com"
r"\n *login (.*)"
r"\n *password (.*)(?:\n|$)");
/// Loads an HTTP basic authentication authorization header from the user's
/// .netrc file.
String _loadAuthorization() {
var netrc = new File(p.join(Platform.environment["HOME"], ".netrc"));
if (!netrc.existsSync()) fail("~/.netrc file not found.");
var match = _netrcRegExp.firstMatch(netrc.readAsStringSync());
if (match == null) {
fail(".netrc file didn't contain an entry for api.github.com.");
}
return "Basic ${BASE64.encode(UTF8.encode("${match[1]}:${match[2]}"))}";
/// Returns the HTTP basic authentication Authorization header from the
/// environment.
String _githubAuthorization() {
var username = _environment("GITHUB_USER");
var token = _environment("GITHUB_AUTH");
return "Basic ${BASE64.encode(UTF8.encode("$username:$token"))}";
}
/// Returns the environment variable named [name], or throws an exception if it
/// can't be found.
String _environment(String name) {
var value = Platform.environment[name];
if (value == null) fail("Required environment variable $name not found.");
return value;
}