Skip to content

18 export dashboard results in a png or a pdf #79

18 export dashboard results in a png or a pdf

18 export dashboard results in a png or a pdf #79

# Check that the version is greater than the previous commit version
# If it is not, fail the build
name: Version upgrade check
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check that the version in back and front are the same
id: version-check
run: |
cd frontend
FRONTEND_VERSION=$(cat package.json | grep -m1 version | cut -d '"' -f 4)
cd ../backend
BACKEND_VERSION=$(cat swagger.yaml | grep -m1 version | cut -d ':' -f 2 | sed 's/ //g')
if [ "$FRONTEND_VERSION" != "$BACKEND_VERSION" ]; then
echo "Version mismatch: frontend/package.json version '$FRONTEND_VERSION' != backend/swagger.yaml version '$BACKEND_VERSION'."
exit 1
fi
echo "Version match: frontend/package.json version '$FRONTEND_VERSION' == backend/swagger.yaml version '$BACKEND_VERSION'."
echo "BRANCH_VERSION=$FRONTEND_VERSION" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
ref: main
- name: Check that the version is greater than the previous commit version
run: |
BRANCH_VERSION=${{ steps.version-check.outputs.BRANCH_VERSION }}
cd frontend
PREVIOUS_VERSION=$(cat package.json | grep -m1 version | cut -d '"' -f 4)
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION"
echo "BRANCH_VERSION=$BRANCH_VERSION"
if [ "$BRANCH_VERSION" == "" ]; then
echo "No version found in current branch."
exit 1
fi
if [ "$PREVIOUS_VERSION" == "" ]; then
echo "No version found in main branch."
exit 1
fi
if [[ $PREVIOUS_VERSION == $BRANCH_VERSION ]]; then
echo "Version not upgraded: frontend/package.json version '$PREVIOUS_VERSION' == branch version '$BRANCH_VERSION'."
exit 1
fi
if [[ $PREVIOUS_VERSION > $BRANCH_VERSION ]]; then
echo "Version not upgraded: frontend/package.json version '$PREVIOUS_VERSION' > branch version '$BRANCH_VERSION'."
exit 1
fi
echo "Version upgraded: frontend/package.json version '$PREVIOUS_VERSION' < branch version '$BRANCH_VERSION'."