From f106420e0a749d03d7d9b9e5082ea4160bf0cdf2 Mon Sep 17 00:00:00 2001 From: Rashmil Panchani <32737711+Rashmil-1999@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:59:39 +0530 Subject: [PATCH] Add version to workflow (#75) * update fonts submodule * data update * update ci file to use version from .toml file * quick fix for pytest --- .github/workflows/ci.yml | 5 +++-- app/crud/crud_station.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7b4c22..a3ec43a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: fi echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV if [ "$BRANCH" == "main" ]; then - version=$(cat package.json | grep \"version\" | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,",]//g' | tr -d '[[:space:]]') + version=$(awk -F= '/^version/ { print $2}' pyproject.toml | sed 's/[ "]//g') tags="latest" oldversion="" while [ "${oldversion}" != "${version}" ]; do @@ -52,6 +52,7 @@ jobs: uses: elgohr/Publish-Docker-Github-Action@3.04 env: BRANCH: ${{ env.GITHUB_BRANCH }} + VERSION: ${{ env.VERSION }} BUILDNUMBER: ${{ github.run_number }} GITSHA1: ${{ github.sha }} with: @@ -60,7 +61,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io tags: "${{ env.TAGS }}" - buildargs: BRANCH,BUILDNUMBER,GITSHA1 + buildargs: BRANCH,VERSION,BUILDNUMBER,GITSHA1 dockerfile: docker/Dockerfile - name: Deploy to prod server diff --git a/app/crud/crud_station.py b/app/crud/crud_station.py index dad1d46..a24a79f 100644 --- a/app/crud/crud_station.py +++ b/app/crud/crud_station.py @@ -15,7 +15,8 @@ def get(self, db: Session, id: Any) -> Optional[Station]: station = cast( Station, db.query(self.model).filter(self.model.name == id).first() ) - station.species = binomial_only(station.species) + if station: + station.species = binomial_only(station.species) return station