Skip to content

Commit

Permalink
Add in deploy script in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasyu888 committed Jun 14, 2023
1 parent e084e0b commit c9ed6ca
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
@@ -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(<package-name>, repos="http://<S3_RAN>.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

0 comments on commit c9ed6ca

Please sign in to comment.