Skip to content

Commit

Permalink
Merge pull request #13 from Boehringer-Ingelheim/11-gh-package-releas…
Browse files Browse the repository at this point in the history
…e-checks

add release checks
  • Loading branch information
sorinvoicu authored Jun 5, 2024
2 parents 26841b2 + 9677205 commit 3b3553a
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
uses: actions/checkout@v4

- name: Install package dependencies 📄
uses: boehringer-ingelheim/dv.templates/.github/actions/dependencies@main
uses: boehringer-ingelheim/dv.templates/.github/actions/dependencies@main

- name: Get validation results
uses: actions/download-artifact@v4
with:
Expand All @@ -34,8 +34,8 @@ jobs:

- name: Check URLs 🌐
run: |
lychee . --format markdown --verbose --no-progress >> $GITHUB_STEP_SUMMARY
shell: bash
lychee . --format markdown --verbose --no-progress --exclude "https://boehringer-ingelheim.github.io*" >> $GITHUB_STEP_SUMMARY
shell: bash

- name: Checkout gh-pages branch ⬇️
if: github.ref_name == 'main'
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Release 📈

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

concurrency:
group: release-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
create-release:
name: ${{ vars.CI_IMAGE }}
runs-on: ubuntu-latest

steps:
- name: Checkout project ⬇️
uses: actions/checkout@v4

- name: NEWS.md and DESCRIPTION Version check 🏁
run: |
DESC_VERSION=$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION | tr -d '\n' | xargs)
NEWS_VERSION=$(awk '/^#+ /{print $3,$4; exit}' NEWS.md | tr -d '\n' | xargs)
DESC_DEV_VERSION=$(echo $DESC_VERSION | awk -F '.' '{print $NF}')
echo "NEWS.md version: $NEWS_VERSION"
echo "DESCRIPTION version: $DESC_VERSION"
if [ $DESC_DEV_VERSION -ge 9000 ]; then
echo "✖️ DESCRIPTION file version is in development mode."
echo "Please fix this."
exit 1
fi
if [ "$DESC_VERSION" = "$NEWS_VERSION" ]; then
echo "✔️ NEWS.md and DESCRIPTION have the same version"
exit 0
else
echo "✖️ NEWS.md and DESCRIPTION have different versions"
echo "Please fix this."
exit 1
fi
shell: bash
6 changes: 5 additions & 1 deletion .github/workflows/shared_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ jobs:

styler:
name: Styler 🌐
uses: boehringer-ingelheim/dv.templates/.github/workflows/styler.yml@main
uses: boehringer-ingelheim/dv.templates/.github/workflows/styler.yml@main

release:
name: Release 📈
uses: boehringer-ingelheim/dv.templates/.github/workflows/release.yml@main
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dv.templates
Title: Provides reusable functionality for R and CI/CD
Version: 0.0.0.9100
Version: 0.1.0
Authors@R: c(
person("Boehringer-Ingelheim Pharma GmbH & Co.KG", role = c("cph", "fnd")),
person("Sorin", "Voicu", email = "[email protected]", role = c("aut", "cre"))
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# dv.templates 0.1.0

- add release checks
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/pkgdown.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/pkgdown.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/roxygen.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/roxygen.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/styler.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/styler.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/release.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/release.yml?query=workflow)

An R package template with built-in GitHub Actions-based CI/CD workflows.

Expand Down
5 changes: 4 additions & 1 deletion workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Generates a [`pkgdown`](https://pkgdown.r-lib.org/) website and uploads it to Gi
Uses [`roxygen`](https://roxygen2.r-lib.org/) to generate `.Rd` files in the
`man/` directory. It also checks if manuals are up-to-date with roxygen comments in the code.

### [`release.yml`](https://github.com/boehringer-ingelheim/dv.templates/blob/main/.github/workflows/release.yml)

Uses adds additional checks before merging the PR to main.

### [`shared_ci.yml`](https://github.com/boehringer-ingelheim/dv.templates/blob/main/.github/workflows/shared_ci.yml)

Builds a reusable workflow to be called from other repositories.
Expand Down Expand Up @@ -71,5 +75,4 @@ jobs:
pkgdown:
name: Pkgdown 📖
uses: boehringer-ingelheim/dv.templates/.github/workflows/pkgdown.yml@main

```

0 comments on commit 3b3553a

Please sign in to comment.