From eeda4c5fd6669b6758acc5afc12a30924d7fb3aa Mon Sep 17 00:00:00 2001 From: sorinvoicu <61691256+sorinvoicu@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:48:03 +0000 Subject: [PATCH] . --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++ .github/workflows/shared_ci.yml | 6 +++- NEWS.md | 3 ++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 NEWS.md 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 da38851..d3a5224 100644 --- a/.github/workflows/shared_ci.yml +++ b/.github/workflows/shared_ci.yml @@ -29,4 +29,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/NEWS.md b/NEWS.md new file mode 100644 index 0000000..0fbfba7 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,3 @@ +# dv.templates 0.0.0.9100 + +- add release checks