Skip to content

Commit 8199a1f

Browse files
committed
feat: get version from tag
1 parent 8a2b7b8 commit 8199a1f

File tree

5 files changed

+51
-13
lines changed

5 files changed

+51
-13
lines changed

.github/workflows/pr-and-push.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pull Request and Push Action
2+
3+
on:
4+
pull_request: # Safer than pull_request_target for untrusted code
5+
branches: [ main ]
6+
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed]
7+
push:
8+
branches: [ main ] # Also run on direct pushes to main
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
call-test-lint:
15+
uses: ./.github/workflows/test-lint.yml
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}

.github/workflows/pypi-publish-on-release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
- published
77

88
jobs:
9+
call-test-lint:
10+
uses: ./.github/workflows/test-lint.yml
11+
with:
12+
ref: ${{ github.event.release.target_commitish }}
13+
914
build:
1015
name: Build distribution 📦
1116
runs-on: ubuntu-latest
@@ -25,6 +30,20 @@ jobs:
2530
python -m pip install --upgrade pip
2631
pip install hatch twine
2732
33+
- name: Validate version
34+
run: |
35+
version=$(hatch version)
36+
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
37+
echo "Valid version format"
38+
exit 0
39+
else
40+
echo "Invalid version format"
41+
exit 1
42+
fi
43+
- name: Run unit tests
44+
run: |
45+
46+
2847
- name: Build
2948
run: |
3049
hatch build

.github/workflows/test-lint-pr.yml renamed to .github/workflows/test-lint.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
name: Test and Lint
22

33
on:
4-
pull_request: # Safer than pull_request_target for untrusted code
5-
branches: [ main ]
6-
types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed]
7-
push:
8-
branches: [ main ] # Also run on direct pushes to main
9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11-
cancel-in-progress: true
4+
workflow_call:
5+
inputs:
6+
ref:
7+
required: true
8+
type: string
129

1310
jobs:
1411
unit-test:
@@ -56,7 +53,7 @@ jobs:
5653
- name: Checkout code
5754
uses: actions/checkout@v4
5855
with:
59-
ref: ${{ github.event.pull_request.head.sha }} # Explicitly define which commit to check out
56+
ref: ${{ inputs.ref }} # Explicitly define which commit to check out
6057
persist-credentials: false # Don't persist credentials for subsequent actions
6158
- name: Set up Python
6259
uses: actions/setup-python@v5
@@ -78,7 +75,7 @@ jobs:
7875
- name: Checkout code
7976
uses: actions/checkout@v4
8077
with:
81-
ref: ${{ github.event.pull_request.head.sha }}
78+
ref: ${{ inputs.ref }}
8279
persist-credentials: false
8380

8481
- name: Set up Python

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ __pycache__*
77
.pytest_cache
88
.ruff_cache
99
*.bak
10-
.vscode
10+
.vscode
11+
dist

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["hatchling"]
2+
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
66
name = "strands-agents"
7-
version = "0.1.5"
7+
dynamic = ["version"]
88
description = "A model-driven approach to building AI agents in just a few lines of code"
99
readme = "README.md"
1010
requires-python = ">=3.10"
@@ -79,6 +79,10 @@ openai = [
7979
"openai>=1.68.0,<2.0.0",
8080
]
8181

82+
[tool.hatch.version]
83+
# Tells Hatch to use your version control system (git) to determine the version.
84+
source = "vcs"
85+
8286
[tool.hatch.envs.hatch-static-analysis]
8387
features = ["anthropic", "litellm", "llamaapi", "ollama", "openai"]
8488
dependencies = [

0 commit comments

Comments
 (0)