From 1e5d549cf46830c989df6acdd3c426b9d1aff267 Mon Sep 17 00:00:00 2001 From: Egill Fridgeirsson Date: Tue, 30 Aug 2022 17:50:10 +0200 Subject: [PATCH] add deploy scripts --- compare_versions | 27 +++++++++++++++++++++++++++ deploy.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 compare_versions create mode 100644 deploy.sh diff --git a/compare_versions b/compare_versions new file mode 100644 index 0000000..54e5fea --- /dev/null +++ b/compare_versions @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +open(R_VERSION, "grep 'Version' DESCRIPTION |"); +$version = ; +close(R_VERSION); + +$version =~ /(\d+)\.(\d+)\.(\d+)/; +$r_major = $1; +$r_minor = $2; +$r_mod = $3; + +open(GIT_VERSION, "git describe --tags |"); +$git = ; +close(GIT_VERSION); + +$git =~ /v(\d+)\.(\d+)\.(\d+)/; +$git_major = $1; +$git_minor = $2; +$git_mod = $3; + +if ($r_major > $git_major || $r_minor > $git_minor || $r_mod > $git_mod) { + $new_version = "v$r_major.$r_minor.$r_mod"; +} else { + $new_version = ""; +} + +print($new_version); diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..9705725 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -o errexit -o nounset +addToDrat(){ + PKG_REPO=$PWD + + ## Build package tar ball + export PKG_TARBALL=$(ls *.tar.gz) + + cd ..; mkdir drat; cd drat + + ## Set up Repo parameters + git init + git config user.name "Martijn Schuemie" + git config user.email "schuemie@ohdsi.org" + git config --global push.default simple + + ## Get drat repo + git remote add upstream "https://$GH_TOKEN@github.com/OHDSI/drat.git" + git fetch upstream 2>err.txt + git checkout gh-pages + + ## Link to local R packages + echo 'R_LIBS=~/Rlib' > .Renviron + + Rscript -e "drat::insertPackage('$PKG_REPO/$PKG_TARBALL', \ + repodir = '.', \ + commit='GitHub Actions release: $PKG_TARBALL run $GITHUB_RUN_ID')" + git push + +} +addToDrat