-
Notifications
You must be signed in to change notification settings - Fork 13
126 lines (108 loc) · 3.91 KB
/
release.yaml
File metadata and controls
126 lines (108 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Release bnbagent to PyPI
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string
release_to_prod:
description: 'Release to production PyPI (unchecked = test PyPI)'
required: false
default: false
type: boolean
skip_tests:
description: 'Skip tests before release'
required: false
default: false
type: boolean
jobs:
release:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # Required for trusted publishing to PyPI
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies
run: |
uv sync --extra dev
- name: Run tests
if: ${{ !inputs.skip_tests }}
run: |
uv run pytest -v
- name: Update version in _version.py
run: |
sed -i 's/^__version__ = ".*"/__version__ = "${{ inputs.version }}"/' bnbagent/_version.py
echo "Updated version to ${{ inputs.version }}"
grep "^__version__" bnbagent/_version.py
- name: Build package
run: |
uv build
- name: Check package contents
run: |
ls -lh dist/
echo "Package files:"
find dist -type f
- name: Publish to Production PyPI
if: ${{ inputs.release_to_prod }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/
print-hash: true
password: ${{ secrets.PYPI_API_TOKEN }}
# Uses trusted publishing (OIDC) - no token needed
# Configure OIDC in PyPI account settings: https://pypi.org/manage/account/publishing/
- name: Publish to Test PyPI
if: ${{ !inputs.release_to_prod }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/
print-hash: true
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# For Test PyPI, you can use trusted publishing or API token
# If using API token, set TEST_PYPI_API_TOKEN secret
- name: Commit version update
if: success() && inputs.release_to_prod
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bnbagent/_version.py
git commit -m "chore: bump version to ${{ inputs.version }}" || exit 0
git push origin HEAD:${{ github.ref_name }} || echo "No changes to commit or branch protection"
- name: Create Git tag
if: success() && inputs.release_to_prod
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "bnbagent-v${{ inputs.version }}" -m "Release bnbagent v${{ inputs.version }}"
git push origin "bnbagent-v${{ inputs.version }}"
- name: Create GitHub Release
if: success() && inputs.release_to_prod
uses: softprops/action-gh-release@v1
with:
tag_name: bnbagent-v${{ inputs.version }}
name: bnbagent v${{ inputs.version }}
body: |
## bnbagent v${{ inputs.version }}
Python SDK for ERC-8004 on-chain agent registration and management.
### Installation
```bash
pip install bnbagent==${{ inputs.version }}
```
generate_release_notes: true
draft: false
prerelease: false