Skip to content

Commit

Permalink
Use Python-compatible versions
Browse files Browse the repository at this point in the history
  • Loading branch information
negz committed Jan 4, 2024
1 parent 29edf77 commit c1e5e20
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
workflow_dispatch:
inputs:
version:
description: PyPI project version (e.g. 0.1.0 - no 'v')
description: PyPI project version (e.g. v0.1.0)
required: false

env:
# Common versions
PYTHON_VERSION: '3.11.5'

# The PyPi project version to push. The default is 0.0.0-gitdate-gitsha.
# The PyPi project version to push. The default is v0.0.0+gitdate-gitsha.
PYPI_VERSION: ${{ inputs.version }}

jobs:
Expand Down Expand Up @@ -70,12 +70,12 @@ jobs:
run: pipx install hatch==1.7.0

# If a version wasn't explicitly passed as a workflow_dispatch input we
# default to version v0.0.0-<git-commit-date>-<git-short-sha>, for example
# v0.0.0-20231101115142-1091066df799. This is a simple implementation of
# default to version v0.0.0+<git-commit-date>-<git-short-sha>, for example
# v0.0.0+20231101115142-1091066df799. This is a simple implementation of
# Go's pseudo-versions: https://go.dev/ref/mod#pseudo-versions.
- name: Set Default PyPI Project Version
if: env.PYPI_VERSION == ''
run: echo "PYPI_VERSION=0.0.0-$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV
run: echo "PYPI_VERSION=v0.0.0+$(date -d@$(git show -s --format=%ct) +%Y%m%d%H%M%S)-$(git rev-parse --short=12 HEAD)" >> $GITHUB_ENV

- name: Set PyPI Project Version
run: hatch version ${{ env.PYPI_VERSION }}
Expand Down
4 changes: 3 additions & 1 deletion crossplane/function/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""The version of function-sdk-python."""

# This is set at build time, using "hatch version"
__version__ = "0.0.0"
__version__ = "0.0.0"
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[build-system]
requires = ["hatchling", "hatch-semver"]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "function-sdk-python"
name = "crossplane-function-sdk-python"
description = 'The Python SDK for Crossplane composition functions'
readme = "README.md"
requires-python = ">=3.11"
Expand Down Expand Up @@ -31,8 +31,7 @@ Source = "https://github.com/crossplane/function-sdk-python"

[tool.hatch.version]
path = "crossplane/function/__version__.py"
scheme = "semver"
validate-bump = false # Allow going from 0.0.0-x to 0.0.0-y.
validate-bump = false # Allow going from 0.0.0.dev0+x to 0.0.0.dev0+y.

[tool.hatch.envs.default]
type = "virtual"
Expand Down

0 comments on commit c1e5e20

Please sign in to comment.