File tree Expand file tree Collapse file tree 6 files changed +98
-0
lines changed
Expand file tree Collapse file tree 6 files changed +98
-0
lines changed Original file line number Diff line number Diff line change 3232
3333 - include : tasks/metrics.yaml
3434 tags : metrics
35+
36+ - include : tasks/cloudflare.yaml
37+ tags : cloudflare
Original file line number Diff line number Diff line change 1+ ---
2+
3+ - name : create .aws directory
4+ ansible.builtin.file :
5+ dest : " dist/.aws"
6+ owner : dist
7+ group : dist
8+ state : directory
9+
10+ - name : copy credentials to deploy release artifacts
11+ ansible.builtin.copy :
12+ content : " {{ secrets.worker_credentials }}"
13+ dest : " dist/.aws/credentials"
14+ owner : dist
15+ group : dist
16+
17+ - name : write worker_config
18+ ansible.builtin.copy :
19+ dest : " dist/.aws/config"
20+ src : " {{ role_path }}/files/worker_config"
21+ owner : dist
22+ group : dist
23+
24+
25+ # https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
26+ - name : Download awscliv2 installer
27+ unarchive :
28+ src : " https://awscli.amazonaws.com/awscli-exe-linux-{{ ansible_architecture }}.zip"
29+ dest : " /tmp"
30+ remote_src : true
31+ creates : ' /tmp/aws'
32+ mode : 0755
33+
34+ - name : Run awscliv2 installer
35+ command :
36+ args :
37+ cmd : " /tmp/aws/install"
38+ creates : /usr/local/bin/aws
39+ become : true
40+ register : aws_install
41+
42+ - name : " Show awscliv2 installer output"
43+ debug :
44+ var : aws_install
45+ verbosity : 2
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ for subdir in $(cd $srcdir && ls); do
5151
5252 if [ " X${version} " == " X" ] && [ " $resha " == " yes" ]; then
5353 ${__dirname} /_resha.sh $site $dstdir $subdir
54+ . ${__dirname} /upload_to_cloudflare.sh $site $subdir
5455 fi
5556
5657 fi
Original file line number Diff line number Diff line change 2525
2626${__dirname} /_resha.sh $site $dstdir $2
2727
28+ . ${__dirname} /upload_to_cloudflare.sh $site $2
29+
2830/home/nodejs/queue-cdn-purge.sh $site resha_release
Original file line number Diff line number Diff line change @@ -36,3 +36,7 @@ chakracore_rc_dirmatch=.*
3636chakracore_release_srcdir=${staging_rootdir}chakracore-release
3737chakracore_release_dstdir=${dist_rootdir}chakracore-release
3838chakracore_release_dirmatch=.*
39+
40+ cloudflare_endpoint=https://07be8d2fbc940503ca1be344714cb0d1.r2.cloudflarestorage.com
41+ cloudflare_profile=worker
42+ destination_bucket=s3://dist-prod
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ site=$1
6+
7+ if [ " X$site " != " Xiojs" ] && [ " X$site " != " Xnodejs" ]; then
8+ echo " Usage: upload_to_cloudflare.sh < iojs | nodejs > <version>"
9+ exit 1
10+ fi
11+
12+ if [ " X$2 " == " X" ]; then
13+ echo " Usage: upload_to_cloudflare.sh < iojs | nodejs > <version>"
14+ exit 1
15+ fi
16+
17+ if [ -z ${dstdir+x} ]; then
18+ echo " \$ dstdir is not set"
19+ exit 1
20+ fi
21+ if [ -z ${dist_rootdir+x} ]; then
22+ echo " \$ dist_rootdir is not set"
23+ exit 1
24+ fi
25+ if [ -z ${destination_bucket+x} ]; then
26+ echo " \$ destination_bucket is not set"
27+ exit 1
28+ fi
29+ if [ -z ${cloudflare_endpoint+x} ]; then
30+ echo " \$ cloudflare_endpoint is not set"
31+ exit 1
32+ fi
33+ if [ -z ${cloudflare_profile+x} ]; then
34+ echo " \$ cloudflare_profile is not set"
35+ exit 1
36+ fi
37+
38+ relativedir=${dstdir/ $dist_rootdir / " $site /" }
39+ tmpversion=$2
40+
41+ aws s3 cp $dstdir /$tmpversion / $destination_bucket /$relativedir /$tmpversion / --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --recursive
42+ aws s3 cp $dstdir /index.json $destination_bucket /$relativedir /index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
43+ aws s3 cp $dstdir /index.tab $destination_bucket /$relativedir /index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
You can’t perform that action at this time.
0 commit comments