2021-01-13 11:56:35 +01:00
|
|
|
---
|
|
|
|
name: Create Pre-Release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Create Pre-Release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
# CHECKOUT CODE
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
# BUILD THE .DEB PACKAGE
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y build-essential devscripts debhelper
|
2021-01-18 14:03:24 +01:00
|
|
|
sudo debuild --buildinfo-option=-O -us -uc -b -j8
|
2021-01-13 11:56:35 +01:00
|
|
|
find ../ -name "*.deb" -exec mv {} cis-hardening.deb \;
|
|
|
|
# DELETE THE TAG NAMED LATEST AND THE CORRESPONDING RELEASE
|
|
|
|
- name: Delete the tag latest and the release latest
|
2021-08-10 10:39:53 +02:00
|
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.0
|
2021-01-13 11:56:35 +01:00
|
|
|
with:
|
|
|
|
delete_release: true
|
|
|
|
tag_name: latest
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# GET LATEST VERSION TAG
|
|
|
|
- name: Get latest version tag
|
2022-03-01 20:28:33 +01:00
|
|
|
uses: actions-ecosystem/action-get-latest-tag@v1.5.0
|
2021-01-13 11:56:35 +01:00
|
|
|
id: get-latest-tag
|
|
|
|
# GENERATE CHANGELOG CORRESPONDING TO COMMIT BETWEEN HEAD AND COMPUTED LAST TAG
|
|
|
|
- name: Generate changelog
|
|
|
|
id: changelog
|
2021-08-10 13:57:13 +02:00
|
|
|
uses: metcalfc/changelog-generator@v1.0.0
|
2021-01-13 11:56:35 +01:00
|
|
|
with:
|
|
|
|
myToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
head-ref: ${{ github.sha }}
|
|
|
|
base-ref: ${{ steps.get-latest-tag.outputs.tag }}
|
|
|
|
# CREATE RELEASE NAMED LATEST
|
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1.1.4
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: latest
|
|
|
|
release_name: Pre-release
|
|
|
|
body: ${{ steps.changelog.outputs.changelog }}
|
|
|
|
draft: false
|
|
|
|
prerelease: true
|
|
|
|
# UPLOAD PACKAGE .DEB
|
|
|
|
- name: Upload Release deb
|
|
|
|
id: upload-release-asset
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./cis-hardening.deb
|
|
|
|
asset_name: cis-hardening.deb
|
|
|
|
asset_content_type: application/vnd.debian.binary-package
|