Skip to content

Commit 70f9dd9

Browse files
committed
ci: automatically publish to package managers (anthropics#189)
1 parent 23ebdf0 commit 70f9dd9

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

.github/workflows/create-releases.yml

+14
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,17 @@ jobs:
1818
with:
1919
repo: ${{ github.event.repository.full_name }}
2020
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
21+
22+
- name: Set up Python
23+
if: ${{ steps.release.outputs.releases_created }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: '3.7'
27+
28+
- name: Publish to PyPI
29+
if: ${{ steps.release.outputs.releases_created }}
30+
run: |
31+
pipx install poetry
32+
bash ./bin/publish-pypi
33+
env:
34+
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}

.github/workflows/publish-pypi.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# workflow for re-running publishing to PyPI in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/anthropics/anthropic-sdk-python/actions/workflows/publish-pypi.yml
3+
name: Publish PyPI
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
name: publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.7'
19+
20+
- name: Publish to PyPI
21+
run: |
22+
pipx install poetry
23+
bash ./bin/publish-pypi
24+
env:
25+
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}

.github/workflows/release-doctor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ jobs:
1717
bash ./bin/check-release-environment
1818
env:
1919
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
20+
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}

bin/check-release-environment

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ if [ -z "${STAINLESS_API_KEY}" ]; then
66
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organisation secrets on GitHub.")
77
fi
88

9+
if [ -z "${PYPI_TOKEN}" ]; then
10+
errors+=("The ANTHROPIC_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organisation secrets.")
11+
fi
12+
913
len=${#errors[@]}
1014

1115
if [[ len -gt 0 ]]; then

release-please-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
],
6060
"reviewers": [
61-
"RobertCraigie"
61+
"@anthropics/sdk"
6262
],
6363
"release-type": "python",
6464
"extra-files": [

0 commit comments

Comments
 (0)