Skip to content

Commit

Permalink
add deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Aug 30, 2022
1 parent bb280c8 commit 1e5d549
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
27 changes: 27 additions & 0 deletions compare_versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/perl

open(R_VERSION, "grep 'Version' DESCRIPTION |");
$version = <R_VERSION>;
close(R_VERSION);

$version =~ /(\d+)\.(\d+)\.(\d+)/;
$r_major = $1;
$r_minor = $2;
$r_mod = $3;

open(GIT_VERSION, "git describe --tags |");
$git = <GIT_VERSION>;
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);
31 changes: 31 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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

0 comments on commit 1e5d549

Please sign in to comment.