Check if changelog was modfified before release

This commit is contained in:
Thibault Ayanides 2021-01-15 08:19:37 +01:00 committed by Thibault Serti
parent 44e7ea7c63
commit 33b0dae4c3
2 changed files with 16 additions and 6 deletions

View File

@ -2,6 +2,7 @@
name: Run functionnal tests name: Run functionnal tests
on: on:
- pull_request - pull_request
- push
jobs: jobs:
functionnal-tests-docker-debian9: functionnal-tests-docker-debian9:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -11,6 +11,7 @@ jobs:
if: github.event.base_ref == 'refs/heads/master' if: github.event.base_ref == 'refs/heads/master'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# GET VERSION TAG
- name: Get latest version number - name: Get latest version number
id: vars id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
@ -19,6 +20,12 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: ${{ steps.vars.outputs.tag }} 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 # BUILD THE .DEB PACKAGE
- name: Build - name: Build
run: | run: |
@ -26,12 +33,14 @@ jobs:
sudo apt-get install -y build-essential devscripts debhelper sudo apt-get install -y build-essential devscripts debhelper
sudo debuild -us -uc sudo debuild -us -uc
find ../ -name "*.deb" -exec mv {} cis-hardening.deb \; find ../ -name "*.deb" -exec mv {} cis-hardening.deb \;
# GENERATE CHANGELOG CORRESPONDING TO ENTRY IN DEBIAN/CHANGELOG # DELETE THE TAG NAMED LATEST AND THE CORRESPONDING RELEASE
- name: Generate changelog - name: Delete the tag latest and the release latest
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 uses: dev-drprasad/delete-tag-and-release@v0.1.2
# IF THERE IS A NEW TAG BUT NO CORRESPONDING ENTRY IN DEBIAN/CHANGELOG with:
- name: Abort if changelog is empty delete_release: true
run: '[ -s changelog.md ] || exit 0' tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CREATE RELEASE # CREATE RELEASE
- name: Create Release - name: Create Release
id: create_release id: create_release