From 93106aabe09b0acdf2bb1a08324d9556bc31fae2 Mon Sep 17 00:00:00 2001 From: adityamehra Date: Wed, 24 Jun 2026 17:06:35 -0700 Subject: [PATCH 1/3] feat(ci): add Test PyPI release workflow for splunk-ao Co-authored-by: Cursor --- .github/workflows/release-splunk-ao-test.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/release-splunk-ao-test.yaml diff --git a/.github/workflows/release-splunk-ao-test.yaml b/.github/workflows/release-splunk-ao-test.yaml new file mode 100644 index 0000000..f1ff0bb --- /dev/null +++ b/.github/workflows/release-splunk-ao-test.yaml @@ -0,0 +1,71 @@ +name: Release splunk-ao to Test PyPI + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (e.g., 1.2.3, 2.0.0b1). Leave empty to use the version already in pyproject.toml.' + required: false + type: string + +jobs: + build: + name: Build package + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get-version.outputs.version }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Poetry + run: pipx install poetry==2.4.1 + + - name: Override version + if: inputs.version != '' + env: + INPUT_VERSION: ${{ inputs.version }} + run: | + poetry version "$INPUT_VERSION" + sed -i "s/__version__ = \".*\"/__version__ = \"${INPUT_VERSION}\"/" src/splunk_ao/__init__.py + + - name: Get current version + id: get-version + run: echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT" + + - name: Build package + run: poetry build + + - name: Upload distributables + uses: actions/upload-artifact@v4 + with: + name: splunk-ao-${{ steps.get-version.outputs.version }} + path: dist/ + + publish: + name: Publish to Test PyPI + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC trusted publishing + environment: + name: testpypi + url: https://test.pypi.org/project/splunk-ao/ + + steps: + - name: Download distributables + uses: actions/download-artifact@v4 + with: + name: splunk-ao-${{ needs.build.outputs.version }} + path: dist/ + + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + verbose: true + print-hash: true From b338f451db797675377e7d10feb8794412069517 Mon Sep 17 00:00:00 2001 From: adityamehra Date: Wed, 24 Jun 2026 17:12:21 -0700 Subject: [PATCH 2/3] feat(ci): run build on PRs, gate publish to workflow_dispatch only Co-authored-by: Cursor --- .github/workflows/release-splunk-ao-test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-splunk-ao-test.yaml b/.github/workflows/release-splunk-ao-test.yaml index f1ff0bb..e8fd323 100644 --- a/.github/workflows/release-splunk-ao-test.yaml +++ b/.github/workflows/release-splunk-ao-test.yaml @@ -1,6 +1,7 @@ name: Release splunk-ao to Test PyPI on: + pull_request: # Runs the build job on every PR push to validate packaging workflow_dispatch: inputs: version: @@ -48,6 +49,7 @@ jobs: publish: name: Publish to Test PyPI + if: github.event_name == 'workflow_dispatch' # Only publish on explicit dispatch, not on PR pushes needs: build runs-on: ubuntu-latest permissions: From 9a22c3ccddafd81cfb80e0039006e8aca2986a3d Mon Sep 17 00:00:00 2001 From: adityamehra Date: Wed, 24 Jun 2026 17:20:03 -0700 Subject: [PATCH 3/3] feat(ci): auto-publish .dev pre-release to Test PyPI on PR pushes Co-authored-by: Cursor --- .github/workflows/release-splunk-ao-test.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-splunk-ao-test.yaml b/.github/workflows/release-splunk-ao-test.yaml index e8fd323..e41232a 100644 --- a/.github/workflows/release-splunk-ao-test.yaml +++ b/.github/workflows/release-splunk-ao-test.yaml @@ -1,11 +1,11 @@ name: Release splunk-ao to Test PyPI on: - pull_request: # Runs the build job on every PR push to validate packaging + pull_request: # Publishes a .dev pre-release on every PR push workflow_dispatch: inputs: version: - description: 'Version to publish (e.g., 1.2.3, 2.0.0b1). Leave empty to use the version already in pyproject.toml.' + description: 'Version to publish (e.g., 1.2.3, 2.0.0b1). Leave empty to use the version in pyproject.toml as-is.' required: false type: string @@ -26,8 +26,19 @@ jobs: - name: Install Poetry run: pipx install poetry==2.4.1 + # PR builds: append .dev so the clean version (e.g. 0.1.0) + # is never consumed on Test PyPI and can still be used for the real release. + - name: Set pre-release version + if: github.event_name == 'pull_request' + run: | + VERSION_BASE="$(poetry version --short)" + PRE_VERSION="${VERSION_BASE}.dev${{ github.run_number }}" + poetry version "$PRE_VERSION" + sed -i "s/__version__ = \".*\"/__version__ = \"${PRE_VERSION}\"/" src/splunk_ao/__init__.py + + # Manual dispatch: use the supplied version if provided. - name: Override version - if: inputs.version != '' + if: github.event_name == 'workflow_dispatch' && inputs.version != '' env: INPUT_VERSION: ${{ inputs.version }} run: | @@ -49,7 +60,6 @@ jobs: publish: name: Publish to Test PyPI - if: github.event_name == 'workflow_dispatch' # Only publish on explicit dispatch, not on PR pushes needs: build runs-on: ubuntu-latest permissions: