Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/release-splunk-ao-a2a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ jobs:
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if ! printf '%s' "$INPUT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$'; then
# Use bash [[ =~ ]] so ^ and $ anchor the entire string, preventing
# multi-line inputs from bypassing the validation (grep -E matches per line).
if [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
echo "::error::Invalid version '${INPUT_VERSION}'. Expected an explicit version like 0.1.0, 1.2.3rc1, or 1.2.3.post1. Bump keywords like 'patch' or 'major' are not accepted."
exit 1
fi
sed -i "s/^version = \".*\"/version = \"${INPUT_VERSION}\"/" pyproject.toml
if ! grep -q "^version = \"${INPUT_VERSION}\"" pyproject.toml; then
echo "::error::Failed to set version in pyproject.toml — the version line format may have changed."
exit 1
fi
sed -i "s/__version__ = \".*\"/__version__ = \"${INPUT_VERSION}\"/" src/splunk_ao_a2a/_version.py
if ! grep -q "__version__ = \"${INPUT_VERSION}\"" src/splunk_ao_a2a/_version.py; then
echo "::error::Failed to set __version__ in src/splunk_ao_a2a/_version.py — the version line format may have changed."
exit 1
fi

- name: Get current version
id: get-version
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/release-splunk-ao-adk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ jobs:
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if ! printf '%s' "$INPUT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$'; then
# Use bash [[ =~ ]] so ^ and $ anchor the entire string, preventing
# multi-line inputs from bypassing the validation (grep -E matches per line).
if [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
echo "::error::Invalid version '${INPUT_VERSION}'. Expected an explicit version like 0.1.0, 1.2.3rc1, or 1.2.3.post1. Bump keywords like 'patch' or 'major' are not accepted."
exit 1
fi
sed -i "s/^version = \".*\"/version = \"${INPUT_VERSION}\"/" pyproject.toml
if ! grep -q "^version = \"${INPUT_VERSION}\"" pyproject.toml; then
echo "::error::Failed to set version in pyproject.toml — the version line format may have changed."
exit 1
fi
sed -i "s/__version__ = \".*\"/__version__ = \"${INPUT_VERSION}\"/" src/splunk_ao_adk/__init__.py
if ! grep -q "__version__ = \"${INPUT_VERSION}\"" src/splunk_ao_adk/__init__.py; then
echo "::error::Failed to set __version__ in src/splunk_ao_adk/__init__.py — the version line format may have changed."
exit 1
fi

- name: Get current version
id: get-version
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/release-splunk-ao.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ jobs:
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if ! printf '%s' "$INPUT_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$'; then
# Use bash [[ =~ ]] so ^ and $ anchor the entire string, preventing
# multi-line inputs from bypassing the validation (grep -E matches per line).
if [[ ! "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
echo "::error::Invalid version '${INPUT_VERSION}'. Expected an explicit version like 0.1.0, 1.2.3rc1, or 1.2.3.post1. Bump keywords like 'patch' or 'major' are not accepted."
exit 1
fi
sed -i "s/^version = \".*\"/version = \"${INPUT_VERSION}\"/" pyproject.toml
if ! grep -q "^version = \"${INPUT_VERSION}\"" pyproject.toml; then
echo "::error::Failed to set version in pyproject.toml — the version line format may have changed."
exit 1
fi
sed -i "s/__version__ = \".*\"/__version__ = \"${INPUT_VERSION}\"/" src/splunk_ao/__init__.py
if ! grep -q "__version__ = \"${INPUT_VERSION}\"" src/splunk_ao/__init__.py; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 nit (other): The pyproject.toml verification is anchored (^version = ...) but the __version__ verification is not. Anchoring it too would make the check more precise and consistent — it guards against accidentally matching an unrelated occurrence (e.g. in a comment or docstring) while the real assignment line was missed by sed. Low priority since sed would update any matching line anyway.

Suggested change
if ! grep -q "__version__ = \"${INPUT_VERSION}\"" src/splunk_ao/__init__.py; then
if ! grep -q "^__version__ = \"${INPUT_VERSION}\"" src/splunk_ao/__init__.py; then

🤖 Generated by Astra

echo "::error::Failed to set __version__ in src/splunk_ao/__init__.py — the version line format may have changed."
exit 1
fi

- name: Get current version
id: get-version
Expand Down
Loading