From c9ed6ca9fb5247d56167ff8812ddc780de013127 Mon Sep 17 00:00:00 2001 From: thomasyu888 Date: Wed, 14 Jun 2023 15:33:35 -0700 Subject: [PATCH] Add in deploy script in repo --- .github/workflows/build.yml | 2 +- tools/deploy.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tools/deploy.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b882ae5..457c4806 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -257,7 +257,7 @@ jobs: export S3_RAN=ran.synapse.org fi - curl -s https://raw.githubusercontent.com/Sage-Bionetworks/CI-Build-Tools/master/r-pkg/deploy.sh | bash + bash tools/deploy.sh # echo "::set-output name=s3_ran::$S3_RAN" echo "s3_ran=$S3_RAN" >> $GITHUB_OUTPUT diff --git a/tools/deploy.sh b/tools/deploy.sh new file mode 100644 index 00000000..5f818dbe --- /dev/null +++ b/tools/deploy.sh @@ -0,0 +1,37 @@ +# This script takes as input the artifacts generated by build jobs and publishes the R packages +# to a S3 hosted CRAN-like repository. Users can then install the packages using the commmand: +# install.packages(, repos="http://.synapse.org") + +# Params +# AWS_ACCESS_KEY_ID -- S3 creds +# AWS_SECRET_ACCESS_KEY -- S3 creds +# S3_RAN -- either "staging-ran.synapse.org" or "ran.synapse.org" +# ARTIFACTS_DIR -- the directory where the artifacts are copied to + +home=`pwd` + +# remove the last build clone +set +e +rm -R ${S3_RAN} +set -e + +# retrieving the current content of S3_RAN +mkdir ${S3_RAN} +cd ${S3_RAN} +aws s3 sync s3://${S3_RAN}/ . +cd .. + +curl -o deploy.R https://raw.githubusercontent.com/Sage-Bionetworks/CI-Build-Tools/master/r-pkg/deploy.R + +R -e "source('$home/deploy.R');\ +jenkins_deploy('$home/$S3_RAN', '$ARTIFACTS_DIR')" + +# upload +cd ${S3_RAN} +aws s3 sync --acl public-read . s3://${S3_RAN}/ +cd .. + +# This section is removed because gh-action +# cleans up the home dir +# clean up +# rm -rf $home