mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
git tag -a creates an annotated tag, which requires a tagger identity.
The create-tag job runs on a bare runner checkout with no git config,
so it failed with "Committer identity unknown" across all 32 publish
workflows added by f0258c9336.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
189 lines
6.2 KiB
YAML
Vendored
189 lines
6.2 KiB
YAML
Vendored
name: 📦 publish openbb-finra
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [develop, v5]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
version-check:
|
|
name: Verify version bump
|
|
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/openbb-finra-v')) || github.event_name == 'workflow_dispatch' }}
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.parse.outputs.version }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: openbb_platform/providers/finra
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
|
|
- name: Parse [project].version from pyproject.toml
|
|
id: parse
|
|
run: |
|
|
VERSION=$(grep -m1 -E '^version[[:space:]]*=' pyproject.toml | sed -E 's/^version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
|
|
if [ -z "$VERSION" ]; then
|
|
echo "::error::Could not parse [project].version from pyproject.toml."
|
|
exit 1
|
|
fi
|
|
echo "Local version: $VERSION"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Fail if version already exists on PyPI
|
|
env:
|
|
VERSION: ${{ steps.parse.outputs.version }}
|
|
run: |
|
|
STATUS=$(curl -sS -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/openbb-finra/${VERSION}/json")
|
|
case "$STATUS" in
|
|
200)
|
|
echo "::error::openbb-finra ${VERSION} is already published on PyPI."
|
|
echo "Bump openbb_platform/providers/finra/pyproject.toml [project].version and re-merge a fresh release branch."
|
|
exit 1
|
|
;;
|
|
404)
|
|
echo "openbb-finra ${VERSION} is not yet on PyPI — proceeding."
|
|
;;
|
|
*)
|
|
echo "::error::Unexpected status $STATUS from PyPI JSON API. Aborting to avoid a silent skip."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
- name: Verify release branch name matches pyproject version
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
VERSION: ${{ steps.parse.outputs.version }}
|
|
BRANCH: ${{ github.event.pull_request.head.ref }}
|
|
run: |
|
|
EXPECTED="release/openbb-finra-v${VERSION}"
|
|
if [ "$BRANCH" != "$EXPECTED" ]; then
|
|
echo "::error::Release branch '${BRANCH}' does not match pyproject version '${VERSION}'."
|
|
echo "Expected branch name: '${EXPECTED}'."
|
|
echo "Either rename the release branch or update [project].version in pyproject.toml so they agree."
|
|
exit 1
|
|
fi
|
|
echo "Branch '${BRANCH}' matches pyproject version '${VERSION}'."
|
|
|
|
build:
|
|
name: Build sdist + wheel
|
|
needs: version-check
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: openbb_platform/providers/finra
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- run: python -m pip install --upgrade pip uv
|
|
|
|
- name: Build sdist + wheel
|
|
run: uv build --no-sources
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: openbb-finra-dist
|
|
path: openbb_platform/providers/finra/dist/
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
test:
|
|
name: Test (${{ matrix.os }} / Python ${{ matrix.python_version }})
|
|
needs: build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { os: ubuntu-latest, python_version: "3.10" }
|
|
- { os: ubuntu-latest, python_version: "3.11" }
|
|
- { os: ubuntu-latest, python_version: "3.12" }
|
|
- { os: ubuntu-latest, python_version: "3.13" }
|
|
- { os: ubuntu-latest, python_version: "3.14" }
|
|
- { os: macos-latest, python_version: "3.10" }
|
|
- { os: macos-latest, python_version: "3.14" }
|
|
- { os: windows-latest, python_version: "3.10" }
|
|
- { os: windows-latest, python_version: "3.14" }
|
|
runs-on: ${{ matrix.os }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: openbb_platform/providers/finra
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
|
|
- uses: actions/setup-python@v6
|
|
with:
|
|
python-version: ${{ matrix.python_version }}
|
|
allow-prereleases: true
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: openbb-finra-dist
|
|
path: openbb_platform/providers/finra/dist
|
|
|
|
- run: python -m pip install --upgrade pip uv
|
|
|
|
- name: Install the dev group then the openbb-finra wheel
|
|
run: |
|
|
uv pip install --system --group dev
|
|
uv pip install --system dist/openbb_finra-*.whl
|
|
|
|
- name: Test the installed wheel
|
|
run: |
|
|
rm -rf openbb_finra
|
|
pytest tests --cov=openbb_finra --cov-report=term-missing --cov-fail-under=100
|
|
|
|
publish:
|
|
name: Publish to PyPI
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: openbb-finra-dist
|
|
path: dist
|
|
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
packages-dir: dist
|
|
|
|
create-tag:
|
|
name: Create release tag
|
|
needs: [publish, version-check]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
PACKAGE: openbb-finra
|
|
VERSION: ${{ needs.version-check.outputs.version }}
|
|
RELEASE_SHA: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
|
|
|
|
- name: Create and push release tag
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
TAG="${PACKAGE}-v${VERSION}"
|
|
git tag -a "$TAG" "$RELEASE_SHA" -m "${PACKAGE} ${VERSION}"
|
|
git push origin "refs/tags/${TAG}"
|