update_files 1.64 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
git branch -D torbrowser-releases
git push github --delete torbrowser-releases

git fetch --all --prune
18

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

Hiro's avatar
Hiro committed
25

26
27
28
29
30
31
32
33
34
35
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
36
      git fetch --all
Hiro's avatar
Hiro committed
37
      wget $r
Hiro's avatar
Hiro committed
38
39
      git add .
      git commit -m '[dist ci] commit from CI runner - update with new torbrowser downloads'
Hiro's avatar
Hiro committed
40
      diffs=$(git diff origin/torbrowser-releases)
Hiro's avatar
Hiro committed
41
42
43
      if [ -z "$diffs" ]; then
          echo "No new releases"
      else
Hiro's avatar
Hiro committed
44
          git push -f --follow-tags origin torbrowser-releases
Hiro's avatar
Hiro committed
45
      fi
Hiro's avatar
Hiro committed
46
      diffs=$(git diff github/torbrowser-releases)
Hiro's avatar
Hiro committed
47
48
49
50
51
      if [ -z "$diffs" ]; then
          echo "No new releases"
      else
          git push -f --follow-tags github torbrowser-releases
      fi
52
53
    fi;
done
54
55
56
57

rclone delete gdrive:releases

for f in $(ls); do
Hiro's avatar
Hiro committed
58
  # Update Google Drive
59
  rclone copy $f gdrive:releases
Hiro's avatar
Hiro committed
60
  # Update Internet Archive
Hiro's avatar
Hiro committed
61
  ia upload $f - --remote-name=$f --metadata="title:New Tor Browser release ${f}." --metadata="mediatype:software"
62
done