mirror of
https://github.com/msberends/AMR.git
synced 2025-12-16 19:40:19 +01:00
update languages
This commit is contained in:
71
.github/prehooks/pre-commit
vendored
Executable file
71
.github/prehooks/pre-commit
vendored
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running pre-commit hook..."
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating R documentation..."
|
||||
if command -v Rscript > /dev/null; then
|
||||
if [ "$(Rscript -e 'cat(all(c('"'roxygen2'"', '"'pkgload'"') %in% rownames(installed.packages())))')" == "TRUE" ]; then
|
||||
Rscript -e "suppressMessages(roxygen2::roxygenise())"
|
||||
currentpkg=`Rscript -e "cat(pkgload::pkg_name())"`
|
||||
git add man/*
|
||||
echo ">> done."
|
||||
else
|
||||
echo ">> R packages 'roxygen2' and 'pkgload' are not installed!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
else
|
||||
echo ">> R is not available on your system!"
|
||||
currentpkg="your"
|
||||
fi
|
||||
echo ">> "
|
||||
|
||||
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo ">> Updating semantic versioning and date..."
|
||||
|
||||
# get tags from remote, and remove tags not on remote:
|
||||
git fetch origin --prune --prune-tags --quiet
|
||||
currenttagfull=`git describe --tags --abbrev=0`
|
||||
currenttag=`git describe --tags --abbrev=0 | sed 's/v//'`
|
||||
if [ "$currenttag" = "" ]; then
|
||||
# there is no tag, so set tag to 0.0.1 and commit index to current count
|
||||
echo ">> - no git tags found, create some using v(x).(y).(z)"
|
||||
currenttag="0.0.1"
|
||||
currentcommit=`git rev-list --count HEAD`
|
||||
else
|
||||
# there is a tag, so base version number on that
|
||||
currentcommit=`git rev-list --count ${currenttagfull}..HEAD`
|
||||
if (( "$currentcommit" == 0 )); then
|
||||
# tag is new, so this must become the version number
|
||||
currentversion="$currenttag"
|
||||
fi
|
||||
echo ">> - latest tag is '${currenttagfull}', with ${currentcommit} previous commits"
|
||||
fi
|
||||
if [ "$currentversion" = "" ]; then
|
||||
# combine tag (e.g. 1.2.3) and commit number (like 5) increased by 9000 to indicate beta version
|
||||
currentversion="$currenttag.$((currentcommit + 9001))" # results in e.g. 1.2.3.9005
|
||||
fi
|
||||
echo ">> - ${currentpkg} pkg version set to ${currentversion}"
|
||||
|
||||
# set version number and date to DESCRIPTION file
|
||||
sed -i -- "s/^Version: .*/Version: ${currentversion}/" DESCRIPTION
|
||||
sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION
|
||||
echo ">> - updated DESCRIPTION"
|
||||
# remove leftover on macOS
|
||||
rm DESCRIPTION--
|
||||
# add to commit
|
||||
git add DESCRIPTION
|
||||
|
||||
# set version number to NEWS file
|
||||
if [ -e "NEWS.md" ]; then
|
||||
sed -i -- "1s/.*/# ${currentpkg} ${currentversion}/" NEWS.md
|
||||
echo ">> - updated NEWS.md"
|
||||
# remove leftover on macOS
|
||||
rm NEWS.md--
|
||||
# add to commit
|
||||
git add NEWS.md
|
||||
else
|
||||
echo ">> - no NEWS.md found!"
|
||||
fi
|
||||
echo ">> "
|
||||
61
.github/workflows/website.yaml
vendored
Normal file
61
.github/workflows/website.yaml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# ==================================================================== #
|
||||
# TITLE #
|
||||
# Antimicrobial Resistance (AMR) Data Analysis for R #
|
||||
# #
|
||||
# SOURCE #
|
||||
# https://github.com/msberends/AMR #
|
||||
# #
|
||||
# LICENCE #
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
||||
# the Free Software Foundation. #
|
||||
# We created this package for both routine data analysis and academic #
|
||||
# research and it was publicly released in the hope that it will be #
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# #
|
||||
# Visit our website for the full manual and a complete tutorial about #
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
# Create a website from the R documentation using pkgdown
|
||||
# Git commit and push to the 'gh-pages' branch
|
||||
|
||||
on:
|
||||
push:
|
||||
# only on main
|
||||
branches: 'main - REMOVE THIS LATER'
|
||||
|
||||
name: Update website
|
||||
|
||||
jobs:
|
||||
update-website:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
# Set up R (current stable version) and developer tools
|
||||
- uses: actions/checkout@v3
|
||||
- uses: r-lib/actions/setup-pandoc@v2
|
||||
- name: Set up R
|
||||
uses: r-lib/actions/setup-r@v2
|
||||
with:
|
||||
r-version: "release"
|
||||
# use RStudio Package Manager (RSPM) to quickly install packages
|
||||
use-public-rspm: true
|
||||
- name: Set up R dependencies
|
||||
uses: r-lib/actions/setup-r-dependencies@v2
|
||||
with:
|
||||
extra-packages: any::pkgdown
|
||||
|
||||
# Send updates to repo using GH Actions bot
|
||||
- name: Create website in separate branch
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
# Rscript -e 'pkgdown::build_favicons()'
|
||||
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE, install = TRUE, branch = "gh-pages")'
|
||||
Reference in New Issue
Block a user