update_files 1.75 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
#
# This file is part of GetTor, a Tor Browser distribution system.
#
# :authors: hiro <hiro@torproject.org>
#           see also AUTHORS file
#
# :copyright:   (c) 2008-2019, The Tor Project, Inc.
#
# :license: This is Free Software. See LICENSE for license information.

cd ~/releases
Hiro's avatar
Hiro committed
13
git checkout master
14
15
16
17
18
19
git branch -D releases
git push origin --delete releases
git branch -D torbrowser-releases
git push github --delete torbrowser-releases

git fetch --all --prune
20

Hiro's avatar
Hiro committed
21
git add .
Hiro's avatar
Hiro committed
22
git commit -am 'Create release branch'
Hiro's avatar
Hiro committed
23
git checkout -b releases
Hiro's avatar
Hiro committed
24
git push -f --follow-tags origin releases
Hiro's avatar
Hiro committed
25
26
27
git checkout -b torbrowser-releases
git push -f --follow-tags github torbrowser-releases

Hiro's avatar
Hiro committed
28

29
30
31
32
33
34
35
36
37
38
for row in $(
    curl -s 'https://aus1.torproject.org/torbrowser/update_3/release/downloads.json' |
    jq -r '.downloads'
  ); do
    r=$(
      echo ${row} |
      egrep -o 'https?://[^ ]+' |
      tr -d '",'
    );
    if [[ $r = *[!\ ]* ]]; then
Hiro's avatar
Hiro committed
39
      git fetch --all
Hiro's avatar
Hiro committed
40
      git checkout releases
Hiro's avatar
Hiro committed
41
      wget $r
Hiro's avatar
Hiro committed
42
43
      git add .
      git commit -m '[dist ci] commit from CI runner - update with new torbrowser downloads'
Hiro's avatar
Hiro committed
44
      diffs=$(git diff origin/releases)
Hiro's avatar
Hiro committed
45
46
47
48
49
      if [ -z "$diffs" ]; then
          echo "No new releases"
      else
          git push -f --follow-tags origin releases
      fi
Hiro's avatar
Hiro committed
50
      git checkout torbrowser-releases
Hiro's avatar
Hiro committed
51
      git merge releases
Hiro's avatar
Hiro committed
52
      diffs=$(git diff github/torbrowser-releases)
Hiro's avatar
Hiro committed
53
54
55
56
57
      if [ -z "$diffs" ]; then
          echo "No new releases"
      else
          git push -f --follow-tags github torbrowser-releases
      fi
58
59
    fi;
done
60
61
62
63

rclone delete gdrive:releases

for f in $(ls); do
Hiro's avatar
Hiro committed
64
  # Update Google Drive
65
  rclone copy $f gdrive:releases
Hiro's avatar
Hiro committed
66
  # Update Internet Archive
Hiro's avatar
Hiro committed
67
  ia upload <identifier> - --remote-name=$f --metadata="title:New Tor Browser release ${f}."
68
done