cmu-delphi / delphi-epidata

An open API for epidemiological data.
https://cmu-delphi.github.io/delphi-epidata/
MIT License
102 stars 68 forks source link

fix(pyclient ci): validate version arg in create-release #1473

Closed dshemetov closed 5 months ago

dshemetov commented 5 months ago

Summary:

Started from this conversation.

Fix the release CI to accept any version number and major, minor, patch as its argument. My test script for the versionNumber logic is below.

Notes:

# Try (major|minor|patch|5.3.0|blah|3.2.2.2)
versionName=major
allowed_pattern="^(major|minor|patch|[0-9]+\.[0-9]+\.[0-9]+)$"

if [[ ! $versionName =~ $allowed_pattern ]]; then
  echo "\nInvalid version name: $versionName"
  exit 1
fi

if [[ $versionName =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
  NEXT_TAG="$versionName"
else
  NEXT_TAG=$(bump2version --dry-run --list $versionName | grep ^new_version | sed -r s,"^.*=",,)
fi
echo "next_tag=$NEXT_TAG"

Prerequisites:

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

dshemetov commented 5 months ago

Cleaned up the commit log by squashing the edits.