Skip to content

Try again incrementing the ver number #18

Try again incrementing the ver number

Try again incrementing the ver number #18

Workflow file for this run

---
name: Package
on: push
jobs:
Package_For_PIP:
strategy:
matrix:
platform: [ubuntu-latest]
python: ['3.x']
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: "Echo Vars"
run: |
echo matrix.platform: ${{ matrix.platform }}
echo matrix.python: ${{ matrix.python }}
- name: Git fetch
run: git fetch --prune --unshallow
- name: Get Version Number
run: |
datestr=$(date +%Y%m%d%H%M%S)
echo datestr=$datestr >> $GITHUB_ENV
branchname=$(git rev-parse --abbrev-ref HEAD)
echo branchname=$branchname >> $GITHUB_ENV
currrelease=$(git describe --abbrev=0 --tags)
echo currrelease=$currrelease >> $GITHUB_ENV
isrrelease=0
if [[ $currversion =~ v[0-9]\. ]]; then
isrrelease=1
currversion=$branchname
else
currversion=$currrelease
fi
echo currversion=$currversion >> $GITHUB_ENV
echo isrrelease=$isrrelease >> $GITHUB_ENV
- name: Set Version Number
run: |
verparts=($(echo $currversion | tr - \n))
len=${#verparts[@]}
if [ $len -gt 1 ]; then
txtversion=${verparts[0]}-${verparts[1]}
else
txtversion=${verparts[0]}
fi
numver=$(echo $currversion | sed -E 's/v([^-]*)/\1/')
if [ $isrrelease ]; then
numverparts=($(echo $numver | tr "." "\n"))
len=${#numverparts[@]}
if [ $len -gt 2 ]; then
numver=${numverparts[0]}.${numverparts[1]}.${numverparts[2]+1}
elif [ $len -eq 2 ]; then
numver=${numverparts[0]}.${numverparts[1]}.1
else
numver=${numverparts[0]}.1.0
fi
numver=$numver.dev$datestr
fi
echo numver=$numver >> $GITHUB_ENV
version=v$numver
echo version=$version >> $GITHUB_ENV
- name: Update Version Number in python files
run: |
cwd
echo sed -i -e "s/version = \"[^\"]*\"/version = \"${version}\"/" $(find . -name "*.py")
sed -i -e "s/version = \"[^\"]*\"/version = \"${version}\"/" $(find . -name "*.py")
echo sed -i -e "s/# Version .*/# Version ${version}/" $(find . -name "*.py")
sed -i -e "s/# Version .*/# Version ${version}/" $(find . -name "*.py")