Skip to content

Move docker builds to GitHub and reorganise the repo #102

Move docker builds to GitHub and reorganise the repo

Move docker builds to GitHub and reorganise the repo #102

name: Version checks
on:
pull_request:
paths:
- 'js-src/**'
- 'modules/**'
- 'bigipreport.ps1'
jobs:
build_and_deploy_ci:
name: Validate that the version has been bumped
runs-on: ubuntu-24.04
steps:
- name: Check out repository
uses: actions/checkout@aabbfeb2ce60b5bd82389903509092c4648a9713
with:
ref: master
- name: Get master branch version
run: |
MASTER_VERSION=$(awk 'BEGIN { FS="="};/^\s*\$Global:ScriptVersion *= *"[0-9]+\.[0-9]+\.[0-9]+/{ gsub(/[^0-9\.]/, "", $2); print $2 }' < ./bigipreport.ps1)
if [[ -z $MASTER_VERSION ]]; then echo "Unable to detect master version"; exit 1; fi
echo $MASTER_VERSION
echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV
- name: Check out repository
uses: actions/checkout@aabbfeb2ce60b5bd82389903509092c4648a9713
- name: Get config version version
run: |
CONFIG_VERSION=$(awk 'BEGIN { FS="="};/ *<Settings version="[0-9]+\.[0-9]+\.[0-9]+/{ gsub(/[^0-9\.]/, "", $2); print $2 }' < ./bigipreportconfig.xml)
if [[ -z $CONFIG_VERSION ]]; then echo "Unable to detect master version"; exit 1; fi
echo $CONFIG_VERSION
echo "CONFIG_VERSION=$CONFIG_VERSION" >> $GITHUB_ENV
- name: Get current version
run: |
CURRENT_VERSION=$(awk 'BEGIN { FS="="};/^\s*\$Global:ScriptVersion *= *"[0-9]+\.[0-9]+\.[0-9]+/{ gsub(/[^0-9\.]/, "", $2); print $2 }' < ./bigipreport.ps1)
if [[ -z $CURRENT_VERSION ]]; then echo "Unable to detect master version"; exit 1; fi
echo $CURRENT_VERSION
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Compare master with current branch
run: |
VERSIONS_OK=1
if [[ "${{ env.CURRENT_VERSION }}" == "${{ env.MASTER_VERSION }}" ]]; then
echo "Version of the incoming branch is the same as master. Please make sure to bump the version"
VERSIONS_OK=0
fi
if [[ "${{ env.CURRENT_VERSION }}" != "`echo -e "${{ env.CURRENT_VERSION }}\n${{ env.MASTER_VERSION }}" | sort -V | tail -n1`" ]]; then
echo "Version of the incoming branch has to be higher than the master branch"
VERSIONS_OK=0
fi
if [[ "${{ env.CONFIG_VERSION }}" != "${{ env.CURRENT_VERSION }}" ]]; then
echo "Version of the branch bigipreportconfig.xml and the version of the bigipreport.ps1 file does not match"
VERSIONS_OK=0
fi
if [[ "$VERSIONS_OK" == 0 ]]; then
echo "Branch configuration settings is not sane, please update according to the errors above"
exit 1
fi