From 33b0dae4c379cbba98102e71bb1f9bed050b51fd Mon Sep 17 00:00:00 2001 From: Thibault Ayanides Date: Fri, 15 Jan 2021 08:19:37 +0100 Subject: [PATCH] Check if changelog was modfified before release --- .github/workflows/functionnal-tests.yml | 1 + .github/workflows/tagged-release.yml | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/functionnal-tests.yml b/.github/workflows/functionnal-tests.yml index 9de5301..074d6db 100644 --- a/.github/workflows/functionnal-tests.yml +++ b/.github/workflows/functionnal-tests.yml @@ -2,6 +2,7 @@ name: Run functionnal tests on: - pull_request + - push jobs: functionnal-tests-docker-debian9: runs-on: ubuntu-latest diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index 47e7e8d..a1134b5 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -11,6 +11,7 @@ jobs: if: github.event.base_ref == 'refs/heads/master' runs-on: ubuntu-latest steps: + # GET VERSION TAG - name: Get latest version number id: vars run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} @@ -19,6 +20,12 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ steps.vars.outputs.tag }} + # GENERATE CHANGELOG CORRESPONDING TO ENTRY IN DEBIAN/CHANGELOG + - name: Generate changelog + run: sed -n -e "/cis-hardening ($(echo ${{ steps.vars.outputs.tag }} | tr -d 'v'))/,/ -- / p" debian/changelog | tail -n +3 | head -n -2 > changelog.md + # IF THERE IS A NEW TAG BUT NO CORRESPONDING ENTRY IN DEBIAN/CHANGELOG, SET JOB TO FAIL + - name: Abort if changelog is empty + run: '[ -s changelog.md ] || (echo "No entry corresponding to the specified version found in debian/changelog"; exit 1)' # BUILD THE .DEB PACKAGE - name: Build run: | @@ -26,12 +33,14 @@ jobs: sudo apt-get install -y build-essential devscripts debhelper sudo debuild -us -uc find ../ -name "*.deb" -exec mv {} cis-hardening.deb \; - # GENERATE CHANGELOG CORRESPONDING TO ENTRY IN DEBIAN/CHANGELOG - - name: Generate changelog - run: sed -n -e "/cis-hardening ($(echo ${{ steps.vars.outputs.tag }} | tr -d 'v'))/,/ -- / p" debian/changelog | tail -n +3 | head -n -2 > changelog.md - # IF THERE IS A NEW TAG BUT NO CORRESPONDING ENTRY IN DEBIAN/CHANGELOG - - name: Abort if changelog is empty - run: '[ -s changelog.md ] || exit 0' + # DELETE THE TAG NAMED LATEST AND THE CORRESPONDING RELEASE + - name: Delete the tag latest and the release latest + uses: dev-drprasad/delete-tag-and-release@v0.1.2 + with: + delete_release: true + tag_name: latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # CREATE RELEASE - name: Create Release id: create_release