Skip to content

Commit

Permalink
dynamic GH version
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinxten committed Feb 2, 2024
1 parent 8f047e2 commit 87db34a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gh-version.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/sh

# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=$(echo $GITHUB_REF | sed -E 's/refs\/tags\/v?([0-9]+\.[0-9]+\.[0-9]+)/\1/')
PLACEHOLDER='__version__ = "0.0.dev0"'
VERSION_FILE='icometrix_sdk/_version.py'

# ensure the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
sed -i '' "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE"
2 changes: 1 addition & 1 deletion icometrix_sdk/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.dev0"
__version__ = "0.0.dev0"

0 comments on commit 87db34a

Please sign in to comment.