version: 3.3.12 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Comparing PR version with the latest version | |
on: | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
version_check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cloning the repository pull request repo... | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Comparing PR version with main... | |
run: | | |
export C_RED="\x1b[91m" | |
export C_GREEN="\x1b[92m" | |
export C_YELLOW="\x1b[93m" | |
export C_RST="\x1b[0m" | |
VERSION_FILE="nova/core/galaxy.yml" | |
REMOTE_VERSION_URL="${{ vars.PROJECT_VERSION_FILE_URL }}" | |
PR_VERSION=$(cat $VERSION_FILE | grep "version:" | cut -d " " -f 2) | |
CURRENT_VERSION=$(curl "$REMOTE_VERSION_URL" -s | grep "version:" | cut -d " " -f 2) | |
echo -n -e "${C_YELLOW}" | |
echo -e "Pull Request Version - $PR_VERSION" | |
echo -e "Current Version - $CURRENT_VERSION" | |
echo -n -e "${C_RST}" | |
if dpkg --compare-versions $PR_VERSION le $CURRENT_VERSION; then | |
echo -n -e "${C_RED}" | |
echo -e "Pull request version $PR_VERSION is <= than current version $CURRENT_VERSION." | |
echo -e "Please update the version in $VERSION_FILE file." | |
echo -n -e "${C_RST}" | |
exit 1 | |
else | |
echo -n -e "${C_GREEN}" | |
echo "Version has been updated moving on" | |
echo -n -e "${C_RST}" | |
fi |