New build version scheme (#305)

* Use separate build tag file

* Implement new versioning scheme

* Update workflow file

Former-commit-id: 80bbbafeb6
This commit is contained in:
David Boreham 2023-04-10 06:43:23 -06:00 committed by GitHub
parent bf85c61711
commit f90000d9cc
5 changed files with 13 additions and 16 deletions

View File

@ -13,15 +13,11 @@ jobs:
steps: steps:
- name: "Clone project repository" - name: "Clone project repository"
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: "Get build info" # TODO: put this in a library - name: "Get build info"
id: build-info id: build-info
run: | run: |
build_time=$(date +'%Y%m%d%H%M') ./scripts/create_build_tag_file.sh
product_version=$( cat app/data/version.txt ) build_tag=$(cat ./app/data/build_tag.txt)
short_sha=$(git rev-parse --short HEAD)
build_tag=$(echo "v${product_version}-${short_sha}-${build_time}")
echo "build-time=${build_time}" >> $GITHUB_OUTPUT
echo "short-sha=${short_sha}" >> $GITHUB_OUTPUT
echo "build-tag=${build_tag}" >> $GITHUB_OUTPUT echo "build-tag=${build_tag}" >> $GITHUB_OUTPUT
- name: "Install Python" - name: "Install Python"
uses: cerc-io/setup-python@v4 uses: cerc-io/setup-python@v4

View File

@ -23,7 +23,7 @@ def command(ctx):
# See: https://stackoverflow.com/a/20885799/1701505 # See: https://stackoverflow.com/a/20885799/1701505
from . import data from . import data
with importlib.resources.open_text(data, "version.txt") as version_file: with importlib.resources.open_text(data, "build_tag.txt") as version_file:
# TODO: code better version that skips comment lines # TODO: code better version that skips comment lines
version_string = version_file.read().splitlines()[1] version_string = version_file.read().splitlines()[1]

View File

@ -1,4 +1,4 @@
# Builds the shiv "package" for distribution # Builds the shiv "package" for distribution
mkdir -p ./package mkdir -p ./package
version_string=$( ./scripts/update_version_file.sh) version_string=$( ./app/data/version.txt )
shiv -c laconic-so -o package/laconic-so-${version_string} . shiv -c laconic-so -o package/laconic-so-${version_string} .

View File

@ -0,0 +1,8 @@
build_tag_file_name=./app/data/build_tag.txt
echo "# This file should be re-generated running: scripts/create_build_tag_file.sh script" > $build_tag_file_name
product_version_string=$( tail -1 ./app/data/version.txt )
commit_string=$( git rev-parse --short HEAD )
timestamp_string=$(date +'%Y%m%d%H%M')
build_tag_string=${product_version_string}-${commit_string}-${timestamp_string}
echo ${build_tag_string} >> $build_tag_file_name
echo ${build_tag_string}

View File

@ -1,7 +0,0 @@
version_file_name=./app/data/version.txt
echo "# This file should be re-generated running: scripts/update-version-file.sh script" > $version_file_name
tag_string=$( git describe --tags --abbrev=0 )
commit_string=$( git rev-parse --short HEAD )
version_string=${tag_string}-${commit_string}
echo ${version_string} >> $version_file_name
echo ${version_string}