Skip to content

Commit 3ca7609

Browse files
authored
Backup docs (flutter#34757)
1 parent 52e8efe commit 3ca7609

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ task:
3131
FIREBASE_MASTER_TOKEN: ENCRYPTED[eb768d18798fdc5abfe09b224e1724c4d82831d715ccf90df2c79d618c317216cbd99493278361f6fe7948b409b603f0]
3232
# For uploading beta docs to Firebase public live site
3333
FIREBASE_PUBLIC_TOKEN: ENCRYPTED[37e8b82f167864cae9a3f4d2cf3f37dea331d9375c295327c45de524f6c588fa6f6d63e5784f10f6d43ce29689f36c92]
34+
# For Uploading to GCS
35+
GCS_SERVICE_ACCOUNT: ENCRYPTED[ca271fed014bfd5e4207c350e6567413574390b9d4152893e64231d9c09613e5c68e66ec8cb4b6025161c85efa057d65]
3436
docs_script: ./dev/bots/docs.sh
3537
- name: deploy_gallery
3638
depends_on:

dev/bots/docs.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/bash
22
set -e
33

4+
function upload_gcs() {
5+
echo $GCS_SERVICE_ACCOUNT > ${HOME}/gcloud-service-key.json
6+
gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
7+
gcloud --quiet config set project flutter-infra
8+
9+
gsutil cp -r "$FLUTTER_ROOT/dev/docs" gs://flutter_docs_backup/${CIRRUS_CHANGE_IN_REPO}/
10+
}
11+
412
function deploy {
513
local total_tries="$1"
614
local remaining_tries=$(($total_tries - 1))
@@ -125,6 +133,9 @@ cp "$FLUTTER_ROOT/dev/docs/google2ed1af765c529f57.html" "$FLUTTER_ROOT/dev/docs/
125133
if [[ -n "$CIRRUS_CI" && -z "$CIRRUS_PR" ]]; then
126134
echo "This is not a pull request; considering whether to upload docs... (branch=$CIRRUS_BRANCH)"
127135
if [[ "$CIRRUS_BRANCH" == "master" ]]; then
136+
echo "Uploading docs to GCS..."
137+
upload_gcs
138+
128139
echo "Updating $CIRRUS_BRANCH docs: https://master-api.flutter.dev/"
129140
# Disable search indexing on the master staging site so searches get only
130141
# the stable site.

0 commit comments

Comments
 (0)