diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown.yml index 2b7c4cb..7517079 100644 --- a/.github/workflows/pkgdown.yml +++ b/.github/workflows/pkgdown.yml @@ -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: @@ -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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0e94f5e --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/shared_ci.yml b/.github/workflows/shared_ci.yml index 8ef22c5..9818295 100644 --- a/.github/workflows/shared_ci.yml +++ b/.github/workflows/shared_ci.yml @@ -45,4 +45,8 @@ jobs: styler: name: Styler 🌐 - uses: boehringer-ingelheim/dv.templates/.github/workflows/styler.yml@main \ No newline at end of file + uses: boehringer-ingelheim/dv.templates/.github/workflows/styler.yml@main + + release: + name: Release 📈 + uses: boehringer-ingelheim/dv.templates/.github/workflows/release.yml@main diff --git a/DESCRIPTION b/DESCRIPTION index 06a3f88..33b5b71 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "sorin.voicu.ext@boehringer-ingelheim.com", role = c("aut", "cre")) diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..855de90 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,3 @@ +# dv.templates 0.1.0 + +- add release checks diff --git a/README.md b/README.md index a228d22..7e3fbf2 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/workflows.md b/workflows.md index afcfdb8..4063b3e 100644 --- a/workflows.md +++ b/workflows.md @@ -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. @@ -71,5 +75,4 @@ jobs: pkgdown: name: Pkgdown 📖 uses: boehringer-ingelheim/dv.templates/.github/workflows/pkgdown.yml@main - ```